Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /sanitizer-api/sanitizer-script-tokenizer.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Sanitizer: script and raw text tokenizer state during sanitization</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/html5lib-testcase-support.js"></script>
</head>
<body>
<script>
promise_test(async () => {
const testcases = await html5lib_testcases_from_response(fetch("sanitizer-script-tokenizer.sub.dat"));
testcases.forEach((testcase, index) => {
test(() => {
const context = document.createElement(testcase["document-fragment"] ?? "div");
let config = undefined;
if (testcase.config) {
config = { sanitizer: JSON.parse(testcase.config) };
}
const method = testcase.method ?? "setHTML";
context[method](testcase.data, config);
assert_testcase(context, testcase);
}, `Testcase #${index} [${testcase.method ?? "setHTML"}], "${testcase.data}", config: "${testcase.config ?? "{}"}"`);
});
}, "Sanitizer script and raw text tokenizer testcases from sub.dat");
</script>
</body>
</html>