Skip to content

Commit

Permalink
Change parser behavior of <select><select>
Browse files Browse the repository at this point in the history
This patch makes the HTML parser convert nested <select> tags into
</select> instead of </select><select> for backwards compatibility with
the old parser. This behavior will apply to any nested selects, such as
<select><div><select>.

This was recommended here:
whatwg/html#10557 (comment)

This will be tested here:
html5lib/html5lib-tests#178 (comment)

Change-Id: I7a39901582b96edc10deca8794b9ce117aa08229
  • Loading branch information
josepharhar authored and chromium-wpt-export-bot committed Dec 4, 2024
1 parent d3d219e commit 9499b57
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@
const outerSelect = document.getElementById('nested1');
const innerSelect = document.getElementById('expectafter1');
const nextDiv = document.getElementById('expectafter1b');
assert_true(!!outerSelect && !!innerSelect);
assert_equals(outerSelect.nextSibling, innerSelect,'Nested select should be pushed out as the next sibling');
assert_equals(innerSelect.nextElementSibling, nextDiv,'Subsequent content is there too');
assert_true(!!outerSelect);
assert_equals(innerSelect, null,'Nested select should be removed');
assert_equals(outerSelect.nextElementSibling, nextDiv,'Subsequent content is there too');
}, 'Nested selects should be retained 1');

test(() => {
const outerSelect = document.getElementById('nested2');
const innerSelect = document.getElementById('expectafter2');
assert_true(!!outerSelect && !!innerSelect);
assert_equals(outerSelect.nextSibling, innerSelect,'Nested select should be pushed out as the next sibling');
assert_true(!!outerSelect);
assert_equals(innerSelect, null,'Nested select should be pushed out as the next sibling');
}, 'Nested selects should be retained 2');
</script>

0 comments on commit 9499b57

Please sign in to comment.