| <?xml version="1.0"?> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <script type="text/javascript"> |
| function debug(str) { |
| t = document.getElementById('console').firstChild; |
| |
| t.data += str + "\n"; |
| } |
| |
| function runTests() { |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| } |
| |
| t = document.getElementById('test'); |
| attr = t.getAttributeNodeNS('http://www.example.org/', 'attr'); |
| errs = false; |
| |
| if (!attr) { |
| debug('Could not find attribute '); |
| return; |
| } |
| |
| if (attr.nodeName != 'test:attr') { |
| debug('attr.nodeName is ' + attr.nodeName + ', expected test:attr'); |
| errs = true; |
| } |
| |
| if (attr.namespaceURI != 'http://www.example.org/') { |
| debug('attr.namespaceURI is ' + attr.namespaceURI + ', expected http://www.example.org'); |
| errs = true; |
| } |
| |
| if (attr.prefix != 'test') { |
| debug('attr.prefix is ' + attr.prefix + ', expected test'); |
| errs = true; |
| } |
| |
| if (attr.localName != 'attr') { |
| debug('attr.localName is ' + attr.localName + ', expected attr'); |
| errs = true; |
| } |
| |
| if (!errs) |
| debug('All tests succeeded!'); |
| } |
| |
| </script> |
| <body onload="runTests();"> |
| <div> |
| This tests that attributes will have the correct namespace, prefix and local name set. |
| </div> |
| <div id="test" xmlns:test="http://www.example.org/" test:attr="Attribute"></div> |
| <pre id="console"> |
| </pre> |
| </body> |
| </html> |