document.getElementsByName-namespace-xhtml.xhtml (1110B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head> 3 <title>getElementsByName and foreign namespaces</title> 4 <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/> 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-getelementsbyname"/> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 </head> 9 <body> 10 <div id="log"></div> 11 <div id="test"> 12 <p name="math"><math name="math" xmlns="http://www.w3.org/1998/Math/MathML"> 13 <mi>a</mi> 14 <mo>+</mo> 15 <mi>b</mi> 16 </math></p> 17 <p name="svg"><svg width="300" height="100" name="svg" xmlns="http://www.w3.org/2000/svg"> 18 <rect width="300" height="100" fill="rgb(0,0,255)"/> 19 </svg></p> 20 </div> 21 <script> 22 test(function() { 23 var ps = document.getElementById("test") 24 .getElementsByTagName("p"); 25 assert_equals(document.getElementsByName("math").length, 1); 26 assert_equals(document.getElementsByName("math")[0], ps[0]); 27 assert_equals(document.getElementsByName("svg").length, 1); 28 assert_equals(document.getElementsByName("svg")[0], ps[1]); 29 }); 30 </script> 31 </body> 32 </html>