Skip to content

Attribute Transformers #57

@jeswin

Description

@jeswin

Initial discussion at #54

Parts of the discussion are copied below for context:

Initial proposal by @spiffytech

Forgo could allow libraries to implement this if component had a method to modify attributes before they're put onto the DOM. Something like:

function someFunc() {
  transformAttr(name, value, args) {
    if (name.startsWith('on')) {
      return autoRedraw(value, args);
    }
    return value;
  },
  render() {...}
}

Then you could imagine a library exposing this the same way forgo-state accepts a component and returns a component with modified lifecycle methods.

Pair this with wanting click handlers to run inside the component's error boundary and we've got two examples where modifying DOM node attributes is useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions