Customized Autonomous Elements #750
Comments
|
The is="" model is intended for allowing built-in browser features of the built-in element to still work. It's not intended as a way of allowing you to write one tag name in your CSS instead of two. For autonomous custom elements, whether or not they inherit from anything between themselves and HTMLElement is an implementation detail. Inheriting from some other autonomous custom element is the same as inheriting from any other random class. (As long as you obey the requirement that HTMLElement end up in the prototype chain at some point.) Finally, it's worth noting that is="" only works with a single level of inheritance; since autonomous custom elements can have arbitrary inheritance chains, it's not a good fit there. Those are the reasons I remember for this. Basically, the model does not fit well, and the benefits are tiny (writing Since we're unlikely to change this, let me close the issue. But, I'm happy to continue discussing in the closed thread. |
Right now, to extend an autonomous Custom Element you extend the JS class and then must register a new tag name. For instance:
However, there isn't a way to customize the base autonomous element in the same way you can customize a built-in element with the
[is]attribute. Being able to do this would make it easier to share CSS and JS that are targeting the base autonmous element's tag name (my-textboxin this case). For example:Implementations currently differ with how they treat this second case:
NotSupportedError: Operation is not supportedMyTextboxclass instead of theMyAutocompleteTextboxclass on the<my-textbox is="autocomplete-textbox">element.I can't find prior discussion indicating why customizing elements is only supported for built-ins and not autonomous, so I'd like to see if this is something that could be supported.
The text was updated successfully, but these errors were encountered: