Skip to content

Commit

Permalink
Fix incorrect tree construction by the AAA
Browse files Browse the repository at this point in the history
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 <masonf@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#922189}
  • Loading branch information
shimashimashi authored and chromium-wpt-export-bot committed Sep 16, 2021
1 parent bb687d5 commit d965d8b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions html/syntax/parsing/adoption_agency_check_the_end_tag_name.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<title>The adoption agency algorithm should check the end tag's name</title>
<link rel="author" href="mailto:n4ag3a2sh1i@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/parsing.html#adoption-agency-algorithm">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>


<script>
'use strict';

// This is a regression test for https://crbug.com/1217523.
test(() => {
const wrapper = document.createElement('div');
const html = '<code some-attribute=""><div><code><code><code><code></code></code></code></code></div></code>';
wrapper.innerHTML = html;
assert_equals(wrapper.innerHTML, html);
}, 'The algorithm should not reparent properly nested tags');

</script>

0 comments on commit d965d8b

Please sign in to comment.