nameditem-08.html (980B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Named items: duplicate id attributes for object and img</title> 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/dom.html#dom-document-nameditem"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <div id="log"></div> 8 <div id="test"> 9 <div id=test2></div> 10 <object id=test2></object> 11 12 <div id=test3></div> 13 <img id=test3 name=non-empty> 14 </div> 15 <script> 16 test(function() { 17 var object = document.querySelector("object"); 18 assert_equals(object.id, "test2"); 19 20 assert_true("test2" in document); 21 assert_equals(document.test2, object); 22 }, "If there is a div and object with same id, the object should be returned"); 23 24 test(function() { 25 var img = document.querySelector("img"); 26 assert_equals(img.id, "test3"); 27 28 assert_true("test3" in document); 29 assert_equals(document.test3, img); 30 }, "If there is a div and img with same id, the img should be returned"); 31 </script>