forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OPTION element: Update OPTION label even if it has invalid markup
https://html.spec.whatwg.org/C/#the-option-element > Content model: > If the element has no label attribute and is not a child of a datalist > element: Text that is not inter-element whitespace. OPTION elements should not have element children, but they can have if web authors add elements by DOM API. For both of drop-down SELECTs and listbox SELECTs, Chrome missed to update OPTION labels. It's a regression since Google Chrome 83 for drop-down SELECT, and the issue exists since the WebKit fork for listbox SELECTs. This CL fixes the issue by using MutationObserver only if an OPTION element has Element children. Bug: 1090806 Change-Id: I69f5aa4646fda0ad2770cc2748016c6b37b3ad06 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2235227 Commit-Queue: Kent Tamura <tkent@chromium.org> Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Cr-Commit-Position: refs/heads/master@{#776436}
- Loading branch information
1 parent
5e30de3
commit 027aefc
Showing
4 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...nal/wpt/html/semantics/forms/the-option-element/dynamic-content-change-rendering-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
|
||
<select> | ||
<option>foo</option> | ||
</select> | ||
|
||
<select multiple> | ||
<option>bar</option> | ||
</select> | ||
|
||
</bod> | ||
</html> |
33 changes: 33 additions & 0 deletions
33
...xternal/wpt/html/semantics/forms/the-option-element/dynamic-content-change-rendering.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<title>Invalidation test on resetting <select></title> | ||
<link rel="help" href="https://html.spec.whatwg.org/C/#concept-option-label"> | ||
<link rel="help" href="http://crbug.com/1090806"> | ||
<link rel="match" href="dynamic-content-change-rendering-ref.html"> | ||
<body> | ||
|
||
<select id="dropdown"> | ||
<option></option> | ||
</select> | ||
|
||
<select id="listbox" multiple> | ||
<option></option> | ||
</select> | ||
|
||
<script> | ||
const selects = document.querySelectorAll('select'); | ||
|
||
const span0 = document.createElement('span'); | ||
selects[0].options[0].appendChild(span0); | ||
|
||
const span1 = document.createElement('span'); | ||
selects[1].options[0].appendChild(span1); | ||
|
||
document.documentElement.addEventListener('TestRendered', e => { | ||
span0.textContent = 'foo'; | ||
span1.textContent = 'bar'; | ||
e.target.removeAttribute('class'); | ||
}); | ||
</script> | ||
</body> | ||
</html> |