blob: cd4d7400021efd3c497f3e18e5ecf6a77162e91c [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("Test that calling setAttributeNS() throws an error when http://www.w3.org/TR/dom/#dom-element-setattributens says it should.");
window.elem = document.createElement('test');
// Spec: http://www.w3.org/TR/dom/#dom-element-setattributens
// Step 5.
shouldThrow("elem.setAttributeNS(null, 'foo:bar', 'baz')", '"Error: NamespaceError: DOM Exception 14"');
// Step 6.
shouldNotThrow("elem.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:abc', 'foo')");
shouldThrow("elem.setAttributeNS('http://www.w3.org/not-XML/1998/namespace', 'xml:abc', 'foo')", '"Error: NamespaceError: DOM Exception 14"');
// Step 7.
shouldNotThrow("elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns', 'http://wwww.example.org')");
shouldThrow("elem.setAttributeNS('http://www.w3.org/2000/not-xmlns/', 'xmlns', 'http://wwww.example.org')", '"Error: NamespaceError: DOM Exception 14"');
shouldNotThrow("elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc', 'http://wwww.example.org')");
shouldThrow("elem.setAttributeNS('http://www.w3.org/2000/not-xmlns/', 'xmlns:abc', 'http://wwww.example.org')", '"Error: NamespaceError: DOM Exception 14"');
// Step 8.
shouldThrow("elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'badprefix:xmlns', 'http://wwww.example.org')", '"Error: NamespaceError: DOM Exception 14"');
shouldThrow("elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'notxmlns', 'http://wwww.example.org')", '"Error: NamespaceError: DOM Exception 14"');
</script>
<script src="../../resources/js-test-post.js"></script>