Skip to content

Commit d965d8b

Browse files
Fix incorrect tree construction by the AAA
Prior to this CL, the following code: <code some-attribute> <div> <code> <code> <code> <code> </code> </code> </code> </code> parsed to this: <code some-attribute></code> <div> <code some-attribute> <code> <code> <code> <code> </code> </code> </code> </code> </code> </div> The adoption agency algorithm reparented the div tag though code tags were properly nested. A step was added to the spec[1] in order to fix this, but not implemented in Chromium. This CL implements it. [1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=24833 Fixed: 1217523 Change-Id: I2ce1ada69d37305041468b9c10f59e6238e9a209 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3162497 Commit-Queue: Mason Freed <[email protected]> Reviewed-by: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#922189}
1 parent bb687d5 commit d965d8b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<title>The adoption agency algorithm should check the end tag's name</title>
3+
<link rel="author" href="mailto:[email protected]">
4+
<link rel="help" href="https://html.spec.whatwg.org/multipage/parsing.html#adoption-agency-algorithm">
5+
<script src="/resources/testharness.js"></script>
6+
<script src="/resources/testharnessreport.js"></script>
7+
8+
9+
<script>
10+
'use strict';
11+
12+
// This is a regression test for https://crbug.com/1217523.
13+
test(() => {
14+
const wrapper = document.createElement('div');
15+
const html = '<code some-attribute=""><div><code><code><code><code></code></code></code></code></div></code>';
16+
wrapper.innerHTML = html;
17+
assert_equals(wrapper.innerHTML, html);
18+
}, 'The algorithm should not reparent properly nested tags');
19+
20+
</script>

0 commit comments

Comments
 (0)