-
Notifications
You must be signed in to change notification settings - Fork 3.5k
selectedcontent element mutation record test is wrong #55849
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
base: master
Are you sure you want to change the base?
Conversation
The replace all primitive uses a single record for additions and removals.
https://bugs.webkit.org/show_bug.cgi?id=301929 rdar://164005712 Reviewed by NOBODY (OOPS!). This is a draft as there are a number of issues with the specification (and tests) and I'm not confident about the tree mutations. Tests changes: - web-platform-tests/wpt#55849
https://bugs.webkit.org/show_bug.cgi?id=301929 rdar://164005712 Reviewed by NOBODY (OOPS!). This is a draft as there are a number of issues with the specification (and tests) and I'm not confident about the tree mutations. Tests changes: - web-platform-tests/wpt#55849
|
Thanks for looking at this. The reason that there are two separate mutations in chromium is because when the third option,
This doesn't match the spec because the option element insertion steps just say to run the selectedness setting algorithm which doesn't clone anything into the selectedcontent element, but I'm not sure if that really is good behavior. Consider the following: <select id=select>
<button>
<selectedcontent></selectedcontent>
</button>
<option>one</option>
</select>
<script>
const option = document.createElement('option');
option.setAttribute('selected', '');
option.textContent = 'two';
select.appendChild(option);
</script>I think that the selectedcontent element definitely needs to be updated for the newly selected option in this case, which can only be done through the option element insertion steps, right? I think this was an oversight when I wrote this part of the spec, unless I'm missing something. I think it would probably be best to update the selectedcontent element in the selectedness setting algorithm, what do you think? |
|
My prototype handles that as part of "finishParsingChildren". I don't really care strongly what we do I suppose, but I do get the feeling we lack a lot of test coverage (what if your example was created imperatively for instance) as there's only a minimal set of tests for this new element. And also that the specification is somewhat incomplete. (I spotted Chromium setting |
https://bugs.webkit.org/show_bug.cgi?id=301929 rdar://164005712 Reviewed by NOBODY (OOPS!). This is a draft as there are a number of issues with the specification (and tests) and I'm not confident about the tree mutations. Tests changes: - web-platform-tests/wpt#55849
https://bugs.webkit.org/show_bug.cgi?id=301929 rdar://164005712 Reviewed by NOBODY (OOPS!). This is a draft as there are a number of issues with the specification (and tests) and I'm not confident about the tree mutations. Tests changes: - web-platform-tests/wpt#55849
This PR makes sure that the contents of the selectedcontent element stay up to date when the selected option is changed in the selectedness setting algorithm. This issue was found here: web-platform-tests/wpt#55849 (comment)
|
This PR should fix the selectedness setting issue: whatwg/html#11890 |
The replace all primitive uses a single record for additions and removals. With this change my prototype passes the test.
I strongly suspect
<option selected><span>span</option> three</option>is also a bug in this test, but I didn't want to change that at the same time.