1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" 3 xmlns:svg="http://www.w3.org/2000/svg" 4 xmlns:xlink="http://www.w3.org/1999/xlink" 5 xmlns:ev="http://www.w3.org/2001/xml-events" 6 xml:space="preserve"> 7 <head> 8 <title/> 9 </head> 10 <body> 11 <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=12733">bug 12733</a>: 12 XPath namespace is attached to a wrong step.</p> 13 <div id="result">FAILURE: script did't run</div> 14 <svg:g id="r_00"/> 15 <script> 16 if (window.layoutTestController) 17 layoutTestController.dumpAsText(); 18 19 function nsResolver(prefix) { 20 var ns={ 21 'ev' : 'http://www.w3.org/2001/xml-events', 22 'mathml' : 'http://www.w3.org/1998/Math/MathML', 23 'svg' : 'http://www.w3.org/2000/svg', 24 'xhtml' : 'http://www.w3.org/1999/xhtml', 25 'xlink' : 'http://www.w3.org/1999/xlink' 26 }; 27 return ns[prefix] || null; 28 } 29 30 var result = document.evaluate("//svg:g[@id = 'r_00']", document.documentElement, nsResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 31 if (result.snapshotLength == 1) 32 document.getElementById("result").firstChild.nodeValue = "SUCCESS"; 33 else 34 document.getElementById("result").firstChild.nodeValue = "FAILURE: " + result.snapshotLength + " node(s) matched - should be 1"; 35 36 // Remove this node from the document so it doesn't make the DumpRenderTree output 37 // different when SVG is enabled and disabled. 38 var g = document.getElementsByTagNameNS("http://www.w3.org/2000/svg", "g")[0]; 39 g.parentNode.removeChild(g); 40 </script> 41 42 </body> 43 </html> 44