-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathElement-setAttributeNS.html
More file actions
27 lines (24 loc) · 1.14 KB
/
Element-setAttributeNS.html
File metadata and controls
27 lines (24 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<script src="support/namespaces.js"></script>
</head>
<body>
<script>
test(t => {
assert_element_accepts_trusted_html_set_ns(window, '0', t, 'a', 'b', RESULTS.HTML);
}, "Element.setAttributeNS assigned via policy (successful HTML transformation)");
test(t => {
assert_element_accepts_trusted_script_set_ns(window, '1', t, 'a', 'b', RESULTS.SCRIPT);
}, "Element.setAttributeNS assigned via policy (successful Script transformation)");
test(t => {
assert_element_accepts_trusted_script_url_set_ns(window, '2', t, 'a', 'b', RESULTS.SCRIPTURL);
}, "Element.setAttributeNS assigned via policy (successful ScriptURL transformation)");
test(t=> {
const policy = trustedTypes.createPolicy("p", { createScriptURL: s => s + s });
assert_element_accepts_value_set_ns("image", "href", policy.createScriptURL("v"), "vv",
NSURI_SVG, NSURI_XLINK);
}, "Element.setAttributeNS accepts a URL on <svg:image xlink:href/>");
</script>