-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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: A step to add "is" content attribute in "new" #3402
Comments
Hmm yeah, in particular https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor doesn't mention the |
@annevk unfortunately directly calling the constructor does not go through that. Rather, concept-element-create calls the constructor, at least for custom elements. |
Because clone algorithm refers to |
@domenic how does that work then if you have your own constructor for a builtin? |
@annevk I'm not sure what your question is. How does the existing spec work? It works pretty well; just follow the algorithms. (In particular the super-call to [HTMLConstructor] is what creates the element.) But, it fails to add the is="" attribute, as @tkent-google noted. I started on this yesterday, but got a bit stuck as there's a clash with the requirement in create-an-element which disallows new attributes being added by the constructor. I'll try again today. |
Cloning using the |
I've wrote up most of a patch for this, but it's getting fairly complicated. I'd like implementer opinions from @tkent-google and anyone else working customized built-ins; I've previously seen @cbrewster and @bzbarsky from Mozilla pop in. Here are some important background constraints. Assume we have a setup like
My in-progress patch ends up looking like the following:
A simpler alternative would be the follows:
Basically the question is whether we want try hard to ensure that customized built-in elements, after they are created, have an What do folks think? |
My gut instinct is that changing parser behavior is pretty fishy.... The current custom element situation as Mozilla is ... temporarily in flux. @smag---- do you know who's on top of them right now? |
Er, @smaug---- see above. |
I like the simpler alternative much better. We should perhaps complement it by adding |
Should we support serialization&parsing round-trip? e.g.
|
I think we should. With the simpler alternative that would mean special casing the serializer. That still seems better than further special casing the parser and might be reasonable anyway to override later-set |
Definitely the simpler thing. Having inconsistent attribute handling in parser feels rather bad. |
Fascinating, I hadn't anticipated people would want to change the serializer. OK, great, I'll work on this path. @annevk I thought about adding an |
@domenic fine with me. |
Part of fixing whatwg/html#3402. This changes two things: * It fixes the cloning steps to consult the internal is value, instead of the is="" content attribute. * It removes the step from createElement()/createElementNS() that would insert an is="" attribute in the created element, as we've now decided that is="" is a way of communicating to the parser, and not a general-purpose indicator of customized built-in-ness.
This follows the DOM changes in whatwg/dom#566, and is part of fixing #3402. The normative changes are to the serialization algorithm, which now writes out the element's is value as its is="" attribute, if no actual is="" attribute is present. The rest of the changes are to introductory text about customized built-in elements.
I've done two PRs that people could take a look at:
|
Copying @whatwg/components to ensure nobody gets surprised by this change. |
Part of fixing whatwg/html#3402. This changes two things: * It fixes the cloning steps to consult the internal is value, instead of the is="" content attribute. * It removes the step from createElement()/createElementNS() that would insert an is="" attribute in the created element, as we've now decided that is="" is a way of communicating to the parser, and not a general-purpose indicator of customized built-in-ness. See also whatwg/html#3444 for the other half of the fix. Tests: web-platform-tests/wpt#9505
This follows the DOM changes in whatwg/dom#566, and is part of fixing #3402. The normative changes are to the serialization algorithm, which now writes out the element's is value as its is="" attribute, if no actual is="" attribute is present. The rest of the changes are to introductory text about customized built-in elements. Tests: web-platform-tests/wpt#9508
Is the only remaining thing here filing a bug against Firefox and Safari? (I'm assuming @tkent-google took care of Chrome.) @dstorey does Edge need a bug for this or are you earlier in your implementation stage? |
We're not at that point yet, so as long as there are tests covering this it should be fine without a bug. |
Yes, I take care of Google Chrome. |
@domenic could you please link the Firefox and Safari bugs? |
Safari does not implement customized built-ins. Gecko's bug is https://bugzilla.mozilla.org/show_bug.cgi?id=1440382. |
This follows the DOM changes in whatwg/dom#566, and is part of fixing whatwg#3402. The normative changes are to the serialization algorithm, which now writes out the element's is value as its is="" attribute, if no actual is="" attribute is present. The rest of the changes are to introductory text about customized built-in elements. Tests: web-platform-tests/wpt#9508
4.13.1.2 Creating a customized built-in element says:
However, I couldn't find a step to add
is
attribute innew
case though I found it in document.createElement() caseThe text was updated successfully, but these errors were encountered: