Re: [w3c/webcomponents] The is="" attribute is confusing? Maybe we should encourage only ES6 class-based extension. (#509)

> @oleersoy : Who is NASA in your allegory?

Anyone who has to spend time explaining the semantics around the `is` element to their development team or their customers.  The net effect of that is going to be very expensive.

What I'm saying though should not be complicated or controversial.  The custom element API should be as simple as possible for the biggest use case, which is making things like `<paper-button>`.

Here is a quote from the spec:

> Note: Extending HTMLButtonElement endows our fancy button with all the DOM properties/methods of `<button>`. That checks off a bunch of stuff we don't have to implement ourselves: disabled property, click() method, keydown listeners, tabindex management. Instead, our focus can be progressively enhancing <button> with custom functionality, namely, the drawRipple() method. Less code, more reuse!

I think this is dead on and genius.  That's exactly how it should be.  I just don't think that we should have to change the `define` call when extending native elements.  If we extend `HTMLButtonElement` in order to get all the DOM properties/methods of `<button>` then that should be enough.  To define the element we should just have to do:

> customElements.define('fancy-button', FancyButton);

Not:
> customElements.define('fancy-button', FancyButton, {extends: 'button'});

The browser should or Polyfill should be able to derive the `{extends: 'button'}` part due to the fact that `FancyButton` extends the `HTMLButtonElement`.

Support for things like `is` can be added, if necessary, but should not pollute the API for everyone else who is not working an an element that needs `is` for PE.  In other words there should be a core spec that corresponds to the core API that does not deal with PE, and PE considerations can then extend that core.

If I need a shovel, then just give me a shovel.  Don't give me a shovel that is both a sledge hammer and a shovel, because I need to expend expend additional energy picking it up every time I want to move some dirt.

I have zero objection to people using `is` or loving `is` or doing things with `is` that perhaps no one should know about.      

-- 
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/509#issuecomment-265878068

Received on Thursday, 8 December 2016 22:43:52 UTC