- From: Joe Pea <notifications@github.com>
- Date: Thu, 01 Feb 2018 07:04:53 +0000 (UTC)
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/webcomponents/issues/662/362177175@github.com>
@prushforth > So are you proposing a) `<web-map mixin="map mymapbehaviour">` or b) `<map mixin="map mymapbehaviour">` where behaviour named "map" is the native behaviour that I was getting from inheriting from HTMLMapElement ? Use tr / my-tr if you have to run with that in your explanation. I hadn't fully answered your question there. With these element behaviors, you'd do this: ```html <table> <tr has="selectable"><td></td></tr> </table> ``` where the `<tr` is the native element, and `selectable` is a behavior applied to the `tr` and which is defined in the application space. If we tried to achieve this with Custom Elements, we'd try: ```html <table> <selectable-tr><td></td></selectable-tr> </table> ``` which doesn't work for the reasons in #590. `has=""` is nice because we can apply any number of **non-native** functionalities to the element: ```html <tr has="selectable click-logger mouse-proximity-action" onproximity="..."><td></td></tr> ``` where `tr` is still just a native builtin `tr` element, and `selectable`, `click-logger`, and `mouse-proximity-action` are **not** native builtins, they are just simple behaviors defined in the application space. At some point, all three of those behaviors **had** to be defined in the application, with classes that _do not_ extend from `HTMLElement`: ```js elementBehaviors.define('selectable', class { ... }) elementBehaviors.define('click-logger', class { ... }) elementBehaviors.define('mouse-proximity-action', class { ... }) ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/webcomponents/issues/662#issuecomment-362177175
Received on Thursday, 1 February 2018 07:05:18 UTC