A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Extending <select> a la chosen/select2


As previously proposed by Paul Irish:


Couldn’t this be achieved using web components?


Certainly it could be started that way, at some point decent components can be added back into the platform potentially.

There is some advantage to be able to sit on native behaviour as a web component so certainly a robust component would help. I am yet to see a robust version that actually works as well as natives.


It could probably be prototyped and polyfilled with Web Components, but:

  1. If we’re being honest, Web Components aren’t exactly ready for prime time. Implementations have hit the brakes on half of the draft components, and the specs as written are still frequently cumbersome and incomplete. (Last time I checked, there still isn’t a way to extend a password element and have it still work as part of a form.)
  2. Using Web Components means loading a lot of extra code that isn’t necessary when you’re using the core, natural features of the browser. There’s a lot to be said for declarative properties - enough for a whole other post.
  3. Using Web Components is somewhere between a little more work for end developers (when it’s just a matter of picking and choosing which drop-in element you want) and a lot of work for end developers (when it’s a matter of actually writing your code from scratch).