Skip to content

Commit

Permalink
Fix: Mis-nested form tags inside template parsed incorrectly
Browse files Browse the repository at this point in the history
Ensures that form end tags inside templates forcibly close any inner
tags, aligning behavior with HTML5 standard:
https://html.spec.whatwg.org/multipage/parsing.html#parsing:~:text=An%20end%20tag%20whose%20tag%20name%20is%20%22form%22

Bug: 352896478
TEST=Added web test case to check parsing behavior with nested form
tags.

Change-Id: Ia3ad421f8c6875942ce0a95cb4c5dcfc8c6833aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6009220
Commit-Queue: Mason Freed <[email protected]>
Reviewed-by: Di Zhang <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1384096}
  • Loading branch information
Terman-thr authored and chromium-wpt-export-bot committed Nov 17, 2024
1 parent 6cf69a4 commit 577bbc9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions html/syntax/parsing/misnested-form-in-template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<link rel="author" href="mailto:[email protected]">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div>
A<template><br>BC<form>D<div>E</form>F</div>G</template>H
</div>

<script>
test(function() {
const wrapper = document.querySelector('div');
const expectedContent = "A<template><br>BC<form>D<div>E</div></form>FG</template>H";
const actualContent = wrapper.innerHTML.trim();
assert_equals(actualContent, expectedContent, "The parsed structure should match the expected result with correctly nested elements.");
}, "Testing parsing of misnested <form> tags inside <template>");
</script>

0 comments on commit 577bbc9

Please sign in to comment.