You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constcontainer=document.createElement("div");console.log("About to set innerHTML");container.innerHTML=`<input type="radio" name="group" checked><input type="radio" name="group" checked>`;console.log("After setting innerHTML");
I get the following in the logs:
5590.176 WebContent(29994): (js log) "About to set innerHTML"
5590.177 WebContent(29994): Inserting input into html
5590.177 WebContent(29994): -> is connected? true
5590.177 WebContent(29994): -> inserted connected radio is checked: true
5590.177 WebContent(29994): Inserting input into html
5590.177 WebContent(29994): -> is connected? true
5590.177 WebContent(29994): -> inserted connected radio is checked: true
5590.177 WebContent(29994): Inserting input into #document-fragment
5590.177 WebContent(29994): -> is connected? false
5590.177 WebContent(29994): Inserting input into #document-fragment
5590.177 WebContent(29994): -> is connected? false
5590.177 WebContent(29994): We parsed a fragment! Is it connected? false
5590.177 WebContent(29994): Inserting input into div
5590.177 WebContent(29994): -> is connected? false
5590.177 WebContent(29994): Inserting input into div
5590.177 WebContent(29994): -> is connected? false
5590.177 WebContent(29994): (js log) "After setting innerHTML"
So what we see is:
First the two inputs are inserted into an HTML element and think they are connected.
Then they're inserted into the document fragment, which correctly is not connected.
Finally they're inserted into the container element, again not connected.
Now, the <input> spec tells us that when the radio buttons are inserted in step 1 above, they need to modify the checkedness of the other radio buttons, because they are connected:
When any of the following phenomena occur, if the element's checkedness state is true after the occurrence, the checkedness state of all the other elements in the same radio button group must be set to false:
...
The HTML parser then creates and inserts the <input> elements.
They are connected because "A node becomes connected when the insertion steps are invoked with it as the argument and it is now connected." 1 and "A node is connected if its shadow-including root is a document." 2 This is true because they're being inserted into an <html> element that has a document parent.
It's quite possible there's some nuance here that I'm unaware of, but it seems like there needs to be some exception made that a node is not "connected" if its document is a temporary one used for fragment parsing. I don't know if there would be repercussions to changing that though.
Thanks!
The text was updated successfully, but these errors were encountered:
What is the issue with the HTML Standard?
While trying to make the last 2 subtests of https://wpt.live/html/semantics/forms/the-input-element/radio-disconnected-group-owner.html pass in Ladybird, we've come across what seems to be a spec bug. I'm not 100% sure of course, but wanted to raise it and see what your opinions are.
Reducing subtest 7 down to this case:
I get the following in the logs:
So what we see is:
container
element, again not connected.Now, the
<input>
spec tells us that when the radio buttons are inserted in step 1 above, they need to modify the checkedness of the other radio buttons, because they are connected:However, the test expects both radio buttons to remain checked when they are added in this way. So, we should not be connected in step 1.
But as far as I can tell, we're following the spec:
<html>
element as the root.<input>
elements.<html>
element that has a document parent.It's quite possible there's some nuance here that I'm unaware of, but it seems like there needs to be some exception made that a node is not "connected" if its document is a temporary one used for fragment parsing. I don't know if there would be repercussions to changing that though.
Thanks!
The text was updated successfully, but these errors were encountered: