OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/js-test.js"></script> |
| 3 |
| 4 <script> |
| 5 description("Test that calling createElementNS() throws an error when http://www
.w3.org/TR/dom/#dom-document-createelementns says it should."); |
| 6 |
| 7 // Spec: http://www.w3.org/TR/dom/#dom-document-createelementns |
| 8 |
| 9 // Step 5. |
| 10 shouldThrow("document.createElementNS(null, 'foo:bar', 'baz')", '"NamespaceError
: Failed to execute \'createElementNS\' on \'Document\': The namespace URI provi
ded (\'\') is not valid for the qualified name provided (\'foo:bar\')."'); |
| 11 |
| 12 // Step 6. |
| 13 shouldNotThrow("document.createElementNS('http://www.w3.org/XML/1998/namespace',
'xml:abc', 'foo')"); |
| 14 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/name
space\') is not valid for the qualified name provided (\'xml:abc\')."'); |
| 15 |
| 16 // Step 7. |
| 17 shouldNotThrow("document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns
', 'http://wwww.example.org')"); |
| 18 shouldThrow("document.createElementNS('http://www.w3.org/2000/not-xmlns/', 'xmln
s', 'http://wwww.example.org')", '"NamespaceError: Failed to execute \'createEle
mentNS\' on \'Document\': The namespace URI provided (\'http://www.w3.org/2000/n
ot-xmlns/\') is not valid for the qualified name provided (\'xmlns\')."'); |
| 19 shouldNotThrow("document.createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns
:abc', 'http://wwww.example.org')"); |
| 20 shouldThrow("document.createElementNS('http://www.w3.org/2000/not-xmlns/', 'xmln
s:abc', 'http://wwww.example.org')", '"NamespaceError: Failed to execute \'creat
eElementNS\' on \'Document\': The namespace URI provided (\'http://www.w3.org/20
00/not-xmlns/\') is not valid for the qualified name provided (\'xmlns:abc\')."'
); |
| 21 |
| 22 // Step 8. |
| 23 shouldThrow("document.createElementNS('http://www.w3.org/2000/xmlns/', 'badprefi
x:xmlns', 'http://wwww.example.org')", '"NamespaceError: Failed to execute \'cre
ateElementNS\' on \'Document\': The namespace URI provided (\'http://www.w3.org/
2000/xmlns/\') is not valid for the qualified name provided (\'badprefix:xmlns\'
)."'); |
| 24 shouldThrow("document.createElementNS('http://www.w3.org/2000/xmlns/', 'notxmlns
', 'http://wwww.example.org')", '"NamespaceError: Failed to execute \'createElem
entNS\' on \'Document\': The namespace URI provided (\'http://www.w3.org/2000/xm
lns/\') is not valid for the qualified name provided (\'notxmlns\')."'); |
| 25 </script> |
| 26 |
OLD | NEW |