Index: LayoutTests/fast/dom/setAttributeNS-namespace-errors.html |
diff --git a/LayoutTests/fast/dom/setAttributeNS-namespace-errors.html b/LayoutTests/fast/dom/setAttributeNS-namespace-errors.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..09ec912594a4c4254db38b21cb9821afd1125f23 |
--- /dev/null |
+++ b/LayoutTests/fast/dom/setAttributeNS-namespace-errors.html |
@@ -0,0 +1,27 @@ |
+<!DOCTYPE html> |
+<script src="../../resources/js-test.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')", '"NamespaceError: Failed to execute \'setAttributeNS\' on \'Element\': \'\' is an invalid namespace for attributes."'); |
+ |
+// 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')", '"NamespaceError: Failed to execute \'setAttributeNS\' on \'Element\': \'http://www.w3.org/not-XML/1998/namespace\' is an invalid namespace for attributes."'); |
+ |
+// 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')", '"NamespaceError: Failed to execute \'setAttributeNS\' on \'Element\': \'http://www.w3.org/2000/not-xmlns/\' is an invalid namespace for attributes."'); |
+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')", '"NamespaceError: Failed to execute \'setAttributeNS\' on \'Element\': \'http://www.w3.org/2000/not-xmlns/\' is an invalid namespace for attributes."'); |
+ |
+// Step 8. |
+shouldThrow("elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'badprefix:xmlns', 'http://wwww.example.org')", '"NamespaceError: Failed to execute \'setAttributeNS\' on \'Element\': \'http://www.w3.org/2000/xmlns/\' is an invalid namespace for attributes."'); |
+shouldThrow("elem.setAttributeNS('http://www.w3.org/2000/xmlns/', 'notxmlns', 'http://wwww.example.org')", '"NamespaceError: Failed to execute \'setAttributeNS\' on \'Element\': \'http://www.w3.org/2000/xmlns/\' is an invalid namespace for attributes."'); |
+</script> |