Node-lookupPrefix.xhtml (1012B)
1 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="test"> 2 <head> 3 <title>Node.lookupPrefix</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 </head> 7 <body xmlns:s="test"> 8 <div id="log"/> 9 <x xmlns:t="test"><!--comment--><?test test?>TEST<x/></x> 10 <script> 11 function lookupPrefix(node, ns, prefix) { 12 test(function() { 13 assert_equals(node.lookupPrefix(ns), prefix) 14 }) 15 } 16 var x = document.getElementsByTagName("x")[0]; 17 lookupPrefix(document, "test", "x") // XXX add test for when there is no documentElement 18 lookupPrefix(document, null, null) 19 lookupPrefix(x, "http://www.w3.org/1999/xhtml", null) 20 lookupPrefix(x, "something", null) 21 lookupPrefix(x, null, null) 22 lookupPrefix(x, "test", "t") 23 lookupPrefix(x.parentNode, "test", "s") 24 lookupPrefix(x.firstChild, "test", "t") 25 lookupPrefix(x.childNodes[1], "test", "t") 26 lookupPrefix(x.childNodes[2], "test", "t") 27 lookupPrefix(x.lastChild, "test", "t") 28 x.parentNode.removeChild(x) 29 </script> 30 </body> 31 </html>