getElementsByClassName-31.htm (844B)
1 <!DOCTYPE html> 2 <html class=foo> 3 <meta charset=utf-8> 4 <title>getElementsByClassName across documents</title> 5 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <div id=log></div> 9 <script class=foo> 10 async_test(function() { 11 var iframe = document.createElement("iframe"); 12 iframe.onload = this.step_func_done(function() { 13 var collection = iframe.contentDocument.getElementsByClassName("foo"); 14 assert_equals(collection.length, 3); 15 assert_equals(collection[0].localName, "html"); 16 assert_equals(collection[1].localName, "head"); 17 assert_equals(collection[2].localName, "body"); 18 }); 19 iframe.src = "getElementsByClassNameFrame.htm"; 20 document.body.appendChild(iframe); 21 }); 22 </script>