Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: LayoutTests/fast/dom/createElementNS-namespace-errors.html

Issue 122083002: createElementNS handles element name 'xmlns' correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed feedback. Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/createElementNS-namespace-errors-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/createElementNS-namespace-errors.html
diff --git a/LayoutTests/fast/dom/createElementNS-namespace-errors.html b/LayoutTests/fast/dom/createElementNS-namespace-errors.html
new file mode 100644
index 0000000000000000000000000000000000000000..1ccfb48246e5033771f56171e127c098f09abdaf
--- /dev/null
+++ b/LayoutTests/fast/dom/createElementNS-namespace-errors.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+
+<script>
+description("Test that calling createElementNS() throws an error when http://www.w3.org/TR/dom/#dom-document-createelementns says it should.");
+
+// Spec: http://www.w3.org/TR/dom/#dom-document-createelementns
+
+// Step 5.
+shouldThrow("document.createElementNS(null, 'foo:bar', 'baz')", '"NamespaceError: Failed to execute \'createElementNS\' on \'Document\': The namespace URI provided (\'\') is not valid for the qualified name provided (\'foo:bar\')."');
+
+// Step 6.
+shouldNotThrow("document.createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:abc', 'foo')");
+shouldThrow("document.createElementNS('http://www.w3.org/not-XML/1998/namespace', 'xml:abc', 'foo')", '"NamespaceError: Failed to execute \'createElementNS\' on \'Document\': The namespace URI provided (\'http://www.w3.org/not-XML/1998/namespace\') is not valid for the qualified name provided (\'xml:abc\')."');
+
+// Step 7.
+shouldNotThrow("document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns', 'http://wwww.example.org')");
+shouldThrow("document.createElementNS('http://www.w3.org/2000/not-xmlns/', 'xmlns', 'http://wwww.example.org')", '"NamespaceError: Failed to execute \'createElementNS\' on \'Document\': The namespace URI provided (\'http://www.w3.org/2000/not-xmlns/\') is not valid for the qualified name provided (\'xmlns\')."');
+shouldNotThrow("document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:abc', 'http://wwww.example.org')");
+shouldThrow("document.createElementNS('http://www.w3.org/2000/not-xmlns/', 'xmlns:abc', 'http://wwww.example.org')", '"NamespaceError: Failed to execute \'createElementNS\' on \'Document\': The namespace URI provided (\'http://www.w3.org/2000/not-xmlns/\') is not valid for the qualified name provided (\'xmlns:abc\')."');
+
+// Step 8.
+shouldThrow("document.createElementNS('http://www.w3.org/2000/xmlns/', 'badprefix:xmlns', 'http://wwww.example.org')", '"NamespaceError: Failed to execute \'createElementNS\' on \'Document\': The namespace URI provided (\'http://www.w3.org/2000/xmlns/\') is not valid for the qualified name provided (\'badprefix:xmlns\')."');
+shouldThrow("document.createElementNS('http://www.w3.org/2000/xmlns/', 'notxmlns', 'http://wwww.example.org')", '"NamespaceError: Failed to execute \'createElementNS\' on \'Document\': The namespace URI provided (\'http://www.w3.org/2000/xmlns/\') is not valid for the qualified name provided (\'notxmlns\')."');
+</script>
+
« no previous file with comments | « no previous file | LayoutTests/fast/dom/createElementNS-namespace-errors-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698