selectedcontent post-connection steps did not break out of the loop#11878
Conversation
| <code>selectedcontent</code> element, then set <var>selectedcontent</var>'s <span | ||
| data-x="selectedcontent-disabled">disabled</span> state to true.</p></li> | ||
| data-x="selectedcontent-disabled">disabled</span> state to true and | ||
| <span>break</span>.</p></li> |
There was a problem hiding this comment.
If I'm understanding things correctly, I think there's an undesirable side-effect of this break. (I got here from reviewing @josepharhar's CL that implements this behavior.)
In particular (and hopefully I'm rememembering how all this stuff works correctly, since I'm not checking all the pieces with the spec as I go along), if we start with:
<select id="s">
<button>
<selectedcontent></selectedcontent>
</button>
<option selected>One</option>
</select>then the <selectedcontent> will initially be filled with "One".
Now, suppose that JS comes along and does:
const sc = document.createElement("selectedcontent");
const o = document.createElement("option");
o.append(sc);
document.getElementById("s").prepend(o);At this point, I think we're going to:
- invoke these post-connection steps being modified in this PR
- break at this
breakstatement - Because of that break, leave the existing
<selectedcontent>element with the "One" contents inside of it.
However, after this change, the "get a select's enabled selectedcontent" algorithm will now return null, because the <selectedcontent> added by the JS above is disabled. This means that as a result of this break, we'll be leaving the previously-working <selectedcontent> element with stale content, permanently. That seems pretty weird to me (though I admit that every case where a <selectedcontent> is disabled is effectively an error case).
There was a problem hiding this comment.
That said, now that I understand @josepharhar's comment on the rationale here, maybe we do need to break if we hit an ancestor selectedcontent, because otherwise the algorithm will go into an infinite loop. So maybe we want to change this so this particular break is only when the ancestor is a selectedcontent element?
There was a problem hiding this comment.
So maybe we want to change this so this particular break is only when the ancestor is a selectedcontent element?
I tried implementing this, but it still encountered an infinite loop in one of the test cases.
There was a problem hiding this comment.
@josepharhar maybe you can propose how you want to address this? Because as-is there's clearly issues too. At least I couldn't implement the specification text in WebKit...
There was a problem hiding this comment.
I think we should address this by leaving the case that David described broken. This is what it looks like after running the script:
<select>
<option>
<selectedcontent></selectedcontent>
</option>
<button>
<selectedcontent></selectedcontent>
</button>
<option selected>one</option>
</select>I don't know why anyone would want to put a second selectedcontent in an option like this. If we leave it "broken" by not updating any of the selectedcontent elements, I think that's fine.
There was a problem hiding this comment.
Ok, I've now made the PR reflect what you wanted and also fixed a couple other nits. I haven't yet checked your tests. Can you review again? And maybe David too if he has the time?
There was a problem hiding this comment.
Thanks, the current state of this PR matches the logic in my chromium patch. I asked David to check again as well.
And also has an unused ancestor variable.
81b1309 to
94faffd
Compare
|
I added another change here to also early return for disabled |
The selectedcontent element's insertion and removal don't match the spec, and in particular they rely on the TreeOrderedList of selectedcontent elements which doesn't exist in the spec in order to decide whether to trigger a clone or not. This patch implements the behavior in the spec behind a flag. The in-progress changes in this spec PR are also included: whatwg/html#11878 Bug: 458113204 Change-Id: I904f83292ec6e6619eb72cdddfc740440edcc753
The selectedcontent element's insertion and removal don't match the spec, and in particular they rely on the TreeOrderedList of selectedcontent elements which doesn't exist in the spec in order to decide whether to trigger a clone or not. This patch implements the behavior in the spec behind a flag. The in-progress changes in this spec PR are also included: whatwg/html#11878 Bug: 458113204 Change-Id: I904f83292ec6e6619eb72cdddfc740440edcc753 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7127725 Reviewed-by: David Baron <[email protected]> Reviewed-by: Joey Arhar <[email protected]> Commit-Queue: Joey Arhar <[email protected]> Cr-Commit-Position: refs/heads/main@{#1584368}
The selectedcontent element's insertion and removal don't match the spec, and in particular they rely on the TreeOrderedList of selectedcontent elements which doesn't exist in the spec in order to decide whether to trigger a clone or not. This patch implements the behavior in the spec behind a flag. The in-progress changes in this spec PR are also included: whatwg/html#11878 Bug: 458113204 Change-Id: I904f83292ec6e6619eb72cdddfc740440edcc753 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7127725 Reviewed-by: David Baron <[email protected]> Reviewed-by: Joey Arhar <[email protected]> Commit-Queue: Joey Arhar <[email protected]> Cr-Commit-Position: refs/heads/main@{#1584368}
The selectedcontent element's insertion and removal don't match the spec, and in particular they rely on the TreeOrderedList of selectedcontent elements which doesn't exist in the spec in order to decide whether to trigger a clone or not. This patch implements the behavior in the spec behind a flag. The in-progress changes in this spec PR are also included: whatwg/html#11878 Bug: 458113204 Change-Id: I904f83292ec6e6619eb72cdddfc740440edcc753 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7127725 Reviewed-by: David Baron <[email protected]> Reviewed-by: Joey Arhar <[email protected]> Commit-Queue: Joey Arhar <[email protected]> Cr-Commit-Position: refs/heads/main@{#1584368}
…spec, a=testonly Automatic update from web-platform-tests Update selectedcontent element to match spec The selectedcontent element's insertion and removal don't match the spec, and in particular they rely on the TreeOrderedList of selectedcontent elements which doesn't exist in the spec in order to decide whether to trigger a clone or not. This patch implements the behavior in the spec behind a flag. The in-progress changes in this spec PR are also included: whatwg/html#11878 Bug: 458113204 Change-Id: I904f83292ec6e6619eb72cdddfc740440edcc753 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7127725 Reviewed-by: David Baron <[email protected]> Reviewed-by: Joey Arhar <[email protected]> Commit-Queue: Joey Arhar <[email protected]> Cr-Commit-Position: refs/heads/main@{#1584368} -- wpt-commits: f42395529af8c46d94203cd12acfdc56f2fdd205 wpt-pr: 57765
And also has an unused ancestor variable.
/form-elements.html ( diff )