-
Notifications
You must be signed in to change notification settings - Fork 12
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
Custom elements require dashes in the name #2
Comments
Thinking about this, one thing is unclear to me... Would the module not give you the class and leave it to authors to register the actual tag? I realize that they could only register something with a dash currently, but I'm trying to understand the boundaries here in order to make sure I am thinking about it correctly...Secondly, does this mean that the core dictionary for HTML itself could be largely done and that while the available tags (even natively/provided) can grow, they wouldn't be part of HTML proper? |
@bkardell these seem like separate issues from the OP, so maybe we should open new issues (this repo is fine) for them if you think they're worth diving into much further. But let me try to answer here...
That's one model! However, I think if the idea is to provide something easy to use, requiring a two-step process (import then define) is trickier than requiring a one-step process (just import). If there are compelling advantages to exposing an element for defining with a custom name, we could consider an additional piece that allows that. For example, // Automatically defines with local name "virtual-list"
import "std:virtual-list";
// No automatic definition
import VirtualList from "std:virtual-list/class";
customElements.define("my-virtual-list", VirtualList);
I think that's possible, but I don't know how the future is going to shake out. Of note, any new HTML elements that expose new capabilities would not be implementable as LAPIs, but I think these days we're probably not in to exposing new capabilities via HTML elements anyway... |
I interpret this in terms of speculative polyfills for a (proposed, nearly standard) but as yet unknown element.
Another possibility: Could we use the "is" attribute? |
I'm not sure I understand that suggestion, or the connection to speculative polyfills. Speculative polyfills are not related to LAPIs, and LAPIs are not able to use magic (like defining custom elements with non-dashed names). |
I can understand your confusion, I should have been clearer. I think the term speculative polyfill is script centric, but is analagous to what I think this topic in the context of layered APIs is partly about (if I understand the whole thing correctly, that is). Anyway I raised an issue on the speculative polyfills about this, maybe that will help you understand my thinking about this. |
@domenic I can see arguments both ways I guess, it's easier to glean whether something is really successful if we can simply analyze markup with a known name as opposed it variable. Though, it feels easier to spec, write and more flexible to use the other way (where authors define) which is why I guess I assumed that'd be the thing, kind of like importing modules I guess... Idk, mostly I think I was just asking for clarification about the thought process/discussions that had already been had there arguing one vs the other since I'm new to this. . |
OK I get it, nothing new, they build on what is already there. |
@bkardell I was certainly picturing that the module would define it's element names. While I like the idea of exploring a way to customize the element name eventually, that seems like more of a v2 feature since we won't want to require authors to do the two step dance if they're happy with the default name (which will by far be the common case, right?). |
Requiring dashes in the name of layered API custom elements seems unfortunate, and removes the ability to build something like MathML as a layered API without changing the layered API spec to include dashes in all the element names.
None of the proposed solutions below feel particularly satisfying:
If we embrace this restriction, instead of fighting it, we have a couple routes to go
<std-infinitelist>
.<infinitelist->
.The text was updated successfully, but these errors were encountered: