Re: [w3c/webcomponents] Is there a way to retrieve the localName from a custom element constructor? (#566)

So I think the API should be an overload of `customElements.get()`. If you pass `get()` a constructor, it'll return the name. I can work on a PR for HTML. Anyone interested in writing tests?

Built-ins:

* Solving this could be done, but I'm a little worried that with a global API we might constrain scoped custom element registries in some way (e.g., requiring constructors to only ever be in a single registry). It would then also have to return an array.
* I also think that if we want this, we should also offer the reverse API for built-ins, e.g., going from `h1` to `HTMLHeadingElement`. Perhaps we could do this by introducing a parallel builtinElements.get() that only works with the builtin registry?

-- 
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/566#issuecomment-371034662

Received on Wednesday, 7 March 2018 06:14:51 UTC