-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move defineElement elsewhere? #431
Comments
|
I don't think we're going to generalize this to arbitrary node types :). But yeah, we might allow custom SVG or MathML elements, and I suppose making people decide between
|
Or |
I think in context it's fine. |
FWIW, I've occasionally wished for a way to know what custom elements have been registered.
While @rniwa didn't intend to suggest a feature, I actually think having window.customElements provide a list of registered elements would be pretty interesting. It could be a dictionary or Map of element names to classes, for example.
Note that there's no potential for conflict between the element registration methods and custom element names, since the element names have to include a hyphen. |
We definitely wouldn't use own properties, but a .get('name') API (plus perhaps more of the map-like friends like iterator) is reasonable. |
- Figured out where custom elements will go in HTML, and started writing as if they were there - Fleshed out and moved around examples and motivation to form an "introduction" section - Separated out and rearranged concepts a bit better (fixes #437) - Started the process of moving the registry to the browsing context instead of document (#369) - Moved to `window.customElements`, an instance of `CustomElementsRegistry`, with one `define` method currently (#431) Still to-do: - fix all broken links detected by respec; a few terms have changed - Look up registry on the browsing context instead of the document - Move custom element semantics into the "HTML+: Custom elements" section - Define a HTML+ patch that adds a `customElements` property to `Window`.
This is now implemented ( Any proposals for new APIs to put on this should be a new issue. I support a |
Hello! I'm reading this standard and found that still you're mentioning defineElement as main function for registering elements. Could you please tell me where can I update the documentation ? Thanks a lot in advance! |
Thanks, I forgot to update the examples. Can do. The spec itself is updated though (those introduction sections are non normative). |
Given the variety of proposals for new custom element related methods that are starting to fly around (e.g. #419 and #427 talk about upgrade-related helpers, plus there's always our plans for a registry API #154), we should start considering changes to the top-level API shape, and decide on something ASAP.
I can imagine three possibilities:
document.customElements.define
. Everything goes on that object.document.customElements
is null for documents without a browsing context.HTMLElement.define
. This makes it a bit clearer things are tied to the browsing context instead of the document. Other things can go there too. Right now the only things on there are a bunch of Node SHOUTY_CONSTANTS.document.defineElement
, and just be sure to block future proposals on accepting one of the above two, at which pointdocument.defineElement
becomes an alias for one of those. This might not be feasible depending on how Custom elements disconnected from a document should not be upgraded #419 goes.@annevk @rniwa @travisleithead thoughts?
The text was updated successfully, but these errors were encountered: