Files
sousa-gecko/testing/web-platform/tests/sanitizer-api/sethtml-tree-construction.sub.dat
T
Noam Rosenthal 9766980efe Bug 2036277 [wpt PR 59541] - Remove special text node behavior from streaming sanitizer, a=testonly
Automatic update from web-platform-tests
Remove special text node behavior from streaming sanitizer

This makes the streaming sanitizer normalize text in some cases,
as the parser sometimes normalizes text as it is inserted.

Also made the streaming sanitizer work for parseHTML, as otherwise
the parseHTML tests would fail due to different handling of text nodes.

Bug: 498272014
Change-Id: I676bb55da63d23d2be65b1fa452728b8eda9f16d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7762013
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org>
Commit-Queue: Noam Rosenthal <nrosenthal@google.com>
Cr-Commit-Position: refs/heads/main@{#1622731}

--

wpt-commits: 564703e637d633b1dc02d458f6f4abc733d00559
wpt-pr: 59541
2026-05-08 08:36:56 +00:00

653 lines
9.3 KiB
Plaintext

#data
test
#document
| "test"
#data
<b>bla</b>
#document
| <b>
| "bla"
#data
<a<embla
#errors
Parse error
#document
#data
<html><head></head><body>test</body></html>
#document
| "test"
#data
<div>test
#document
| <div>
| "test"
#data
<script>alert('i am a test')</script>
#document
#data
hello<script>alert('i am a test')</script>
#document
| "hello"
#data
<div><b>hello<script>alert('i am a test')</script>
#document
| <div>
| <b>
| "hello"
#data
<p onclick='a= 123'>Click.</p>
#document
| <p>
| "Click."
#data
<plaintext><p>text</p>
#config
{}
#document
| <plaintext>
| "<p>text</p>"
#data
<xmp>TEXT</xmp>
#config
{}
#document
| <xmp>
| "TEXT"
#data
test
#config
{ "test": 123 }
#document
| "test"
#data
test
#config
{ "removeElements": [] }
#document
| "test"
#data
<div>test</div><p>bla
#config
{ "removeElements": ["div"] }
#document
| <p>
| "bla"
#data
<custom-element>test1</custom-element>bla
#document
| "bla"
#data
<custom-element>test3</custom-element>bla
#config
{ "elements": ["custom-element"] }
#document
| <custom-element>
| "test3"
| "bla"
#data
<custom-element>test5</custom-element>bla
#config
{ "removeElements": ["custom-element"] }
#document
| "bla"
#data
<script>alert('i am a test')</script>
#config
{ "removeElements": ["script"] }
#document
#data
<div>balabala<i>test</i></div><test-element>t</test-element>
#config
{ "removeElements": ["test-element", "i"] }
#document
| <div>
| "balabala"
#data
<div>balabala<i>i</i><p>t</p></div>
#config
{ "removeElements": ["dl", "p"] }
#document
| <div>
| "balabala"
| <i>
| "i"
#data
<div>test<div>p</div>tt<p>div</p></div>
#config
{ "elements": ["p"], "replaceWithChildrenElements": ["div"] }
#document
| "testptt"
| <p>
| "div"
#data
<div>test</div><p>bla
#config
{ "removeElements": ["div"], "elements": ["div"] }
#error
TypeError
#data
<p id='test'>Click.</p>
#config
{ "removeAttributes": [] }
#document
| <p>
| id="test"
| "Click."
#data
<p id='test'>Click.</p>
#config
{ "removeAttributes": ["id"] }
#document
| <p>
| "Click."
#data
<p id='test'>Click.</p>
#config
{ "elements": ["p"], "removeAttributes": ["id"] }
#document
| <p>
| "Click."
#data
<p id='p' data-attribute-with-dashes='123'>Click.</p><script>document.getElementById('p').dataset.attributeWithDashes=123;</script>
#config
{ "elements": ["p"], "removeAttributes": ["data-attribute-with-dashes"] }
#document
| <p>
| id="p"
| "Click."
#data
<p id='p' title='p'>P</p><div id='div' title='div'>DIV</div>
#config
{ "elements": [
{ "name": "p", "attributes": ["title"] },
{ "name": "div", "attributes": ["id"] }
]}
#document
| <p>
| title="p"
| "P"
| <div>
| id="div"
| "DIV"
#data
<p id='p' title='p'>P</p><div id='div' title='div'>DIV</div>
#config
{ "elements":
[
{ "name": "p", "removeAttributes": ["title"] },
{ "name": "div", "removeAttributes": ["id"] }
]
}
#document
| <p>
| id="p"
| "P"
| <div>
| title="div"
| "DIV"
#data
<div id='div' title='div'>DIV</div>
#config
{ "elements": [{ "name": "div", "attributes": ["id"], "removeAttributes": ["id"] }]}
#error
TypeError
#data
<div id='div' title='div'>DIV</div>
#config
{ "elements": [{ "name": "div", "attributes": ["id", "title"] }],
"attributes": []}
#document
| <div>
| id="div"
| title="div"
| "DIV"
#data
<div id='div' title='div'>DIV</div>
#config
{
"elements": [{ "name": "div", "attributes": [] }],
"removeAttributes": ["id", "title"]
}
#document
| <div>
| "DIV"
#data
<div id='div' title='div'>DIV</div>
#config
{
"elements": [{ "name": "div", "removeAttributes": ["id", "title"] }],
"attributes": ["id", "title"]
}
#document
| <div>
| "DIV"
#data
<p id='test' onclick='a= 123'>Click.</p>
#config
{ "attributes": ["id"] }
#document
| <p>
| id="test"
| "Click."
#data
<p style='color: black'>Click.</p>
#config
{ "removeAttributes": ["style"], "attributes": ["style"] }
#error
TypeError
#data
<template><script>test</script><div>hello</div></template>
#config
{ "elements": ["template", "div"] }
#document
| <template>
| content
| <div>
| "hello"
#data
<a href='javascript:evil.com'>Click.</a>
#document
| <a>
| "Click."
#data
<a href=' javascript:evil.com'>Click.</a>
#document
| <a>
| "Click."
#data
<a href='http:evil.com'>Click.</a>
#document
| <a>
| href="http:evil.com"
| "Click."
#data
<area href='javascript:evil.com'>
#config
{}
#document
| <area>
#data
<area href=' javascript:evil.com'>
#config
{}
#document
| <area>
#data
<area href='http:evil.com'>
#config
{}
#document
| <area>
| href="http:evil.com"
#data
<form action='javascript:evil.com'>Click.</form>
#config
{}
#document
| <form>
| "Click."
#data
<form action=' javascript:evil.com'>Click.</form>
#config
{}
#document
| <form>
| "Click."
#data
<form action='http:evil.com'>Click.</form>
#config
{}
#document
| <form>
| action="http:evil.com"
| "Click."
#data
<input formaction='javascript:evil.com'>
#config
{}
#document
| <input>
#data
<input formaction=' javascript:evil.com'>
#config
{}
#document
| <input>
#data
<input formaction='http:evil.com'>
#config
{}
#document
| <input>
| formaction="http:evil.com"
#data
<button formaction='javascript:evil.com'>Click.</button>
#config
{}
#document
| <button>
| "Click."
#data
<button formaction=' javascript:evil.com'>Click.</button>
#config
{}
#document
| <button>
| "Click."
#data
<button formaction='http:evil.com'>Click.</button>
#config
{}
#document
| <button>
| formaction="http:evil.com"
| "Click."
#data
<p>Some text</p></body><!-- 1 --></html><!-- 2 --><p>Some more text</p>
#document
| <p>
| "Some text"
| <p>
| "Some more text"
#data
<p>Some text</p><!-- 1 --><!-- 2 --><p>Some more text</p>
#document
| <p>
| "Some text"
| <p>
| "Some more text"
#data
<p>Some text</p><!-- 1 --><!-- 2 --><p>Some more text</p>
#config
{ "comments": true }
#document
| <p>
| "Some text"
| <!-- 1 -->
| <!-- 2 -->
| <p>
| "Some more text"
#data
<p>Some text</p><!-- 1 --><!-- 2 --><p>Some more text</p>
#config
{ "comments": false }
#document
| <p>
| "Some text"
| <p>
| "Some more text"
#data
<p>comment<!-- hello -->in<!-- </p> -->text</p>
#document
| <p>
| "commentintext"
#data
<p>comment<!-- hello -->in<!-- </p> -->text</p>
#config
{ "comments": true }
#document
| <p>
| "comment"
| <!-- hello -->
| "in"
| <!-- </p> -->
| "text"
#data
<p>comment<!-- hello -->in<!-- </p> -->text</p>
#config
{ "comments": false }
#document
| <p>
| "commentintext"
#data
<svg></svg>
#config
{ "elements": ["svg"] }
#document
#data
<div><svg></svg></div>
#config
{ "elements": ["div", "svg"] }
#document
| <div>
#data
<div>balabala<dl>test</dl></div>
#config
{ "removeElements": ["I", "DL"] }
#document
| <div>
| "balabala"
| <dl>
| "test"
#data
<div>balabala<dl>test</dl></div>
#config
{ "removeElements": ["i", "dl"] }
#document
| <div>
| "balabala"
#data
<DIV>balabala<DL>test</DL></DIV>
#config
{ "removeElements": ["i", "dl"] }
#document
| <div>
| "balabala"
#data
<p id="test">Click.</p>
#config
{ "removeAttributes": ["ID"] }
#document
| <p>
| id="test"
| "Click."
#data
<p ID="test">Click.</p>
#config
{ "removeAttributes": ["ID"] }
#document
| <p>
| id="test"
| "Click."
#data
<p ID="test">Click.</p>
#config
{ "removeAttributes": ["id"] }
#document
| <p>
| "Click."
#data
<div>balabala<i>test</i></div><test>t</test><custom-element>custom-element</custom-element>
#config
{ "removeElements": [123, "test", "i", "custom-element"] }
#document
| <div>
| "balabala"
#data
<div>balabala<i>test</i></div><test>t</test><custom-element>custom-element</custom-element>
#config
{ "replaceWithChildrenElements": [123, "test", "i", "custom-element"],
"elements": ["div"]}
#document
| <div>
| "balabalatest"
| "tcustom-element"
#data
<div>test<div>p</div>tt<p>div</p></div><test>test</test>
#config
{ "elements": ["p", "test"], "replaceWithChildrenElements": ["div"] }
#document
| "testptt"
| <p>
| "div"
| <test>
| "test"
#data
test<div>p</div>tt<p>div</p><test>test</test>
#config
{ "elements": ["p", "test"], "replaceWithChildrenElements": ["div"] }
#document
| "testptt"
| <p>
| "div"
| <test>
| "test"
#data
<div hello='1' world='2'><b hello='3' world='4'>
#config
{ "elements": ["div", "b"], "attributes": ["hello", "world"] }
#document
| <div>
| hello="1"
| world="2"
| <b>
| hello="3"
| world="4"
#data
<div hello='1' world='2'><b hello='3' world='4'>
#config
{ "elements": ["div", "b"], "removeAttributes": ["hello", "world"] }
#document
| <div>
| <b>
#data
<table><div><td>
#config
{ "replaceWithChildrenElements": ["table"] }
#document
| <div>
| <tbody>
| <tr>
| <td>
#data
<template><div>Hello</div></template>
#config
{}
#document
| <template>
| content
| <div>
| "Hello"
#data
<template><div>Hello</div></template>
#config
{ "elements": ["div"]}
#document
#data
<template><div>Hello</div></template>
#config
{ "elements": ["template"]}
#document
| <template>
| content
#data
<template><div>Hello</div></template>
#config
{ "elements": ["div", "template"]}
#document
| <template>
| content
| <div>
| "Hello"
#data
<template><div>Hello</div></template>
#config
{ "elements": ["template"], "replaceWithChildrenElements": ["div"]}
#document
| <template>
| content
| "Hello"
#data
<a href="about:blank" rel="opener">Click.</a>
#document
| <a>
| href="about:blank"
| "Click."
#data
<div><b><em><foo><foob><fooc><aside></b></em></div>
#config
{ "removeElements": ["em"] }
#document
| <div>
| <b>
| <aside>
| <b>