Automatic update from web-platform-tests Remove "tentative" from sanitizer API tests. Note that some tests remain tentative as they rely on features that are not in the spec yet (sanitizing declarative shadow DOM, trusted types createParserOptions) -- wpt-commits: e926c7f66f356e140bb8fc941ba19ea58cd53e1b wpt-pr: 59400
39 lines
1.1 KiB
HTML
39 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
test(t => {
|
|
let d = document.createElement("div")
|
|
d.setHTML("<hello><world>",
|
|
{ sanitizer: { elements: ["b", "em"] } });
|
|
assert_equals(d.innerHTML, "");
|
|
}, "Unknown element names get blocked without being allowed.");
|
|
|
|
test(t => {
|
|
let d = document.createElement("div")
|
|
d.setHTML("<hello><world>",
|
|
{ sanitizer: { elements: ["hello", "world"] } });
|
|
assert_equals(d.innerHTML, "<hello><world></world></hello>");
|
|
}, "Unknown element names pass when allowed.");
|
|
|
|
test(t => {
|
|
let d = document.createElement("div")
|
|
d.setHTML("<b hello='1' world>",
|
|
{ sanitizer: { attributes: ["name", "href"] } });
|
|
assert_equals(d.innerHTML, "<b></b>");
|
|
}, "Unknown attributes names get blocked without being allowed.");
|
|
|
|
test(t => {
|
|
let d = document.createElement("div")
|
|
d.setHTML("<b hello='1' world>",
|
|
{ sanitizer: { attributes: ["hello", "world"] } });
|
|
assert_equals(d.innerHTML, `<b hello="1" world=""></b>`);
|
|
}, "Unknown attribute names pass when allowed.");
|
|
</script>
|
|
</body>
|
|
</html>
|