window-named-properties-003.html (1486B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Shadow DOM Test: Window object named properties: "id" attribute</title> 5 <link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru"> 6 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> 7 <link rel="author" title="Yuta Kitamura" href="mailto:yutak@google.com"> 8 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#upper-boundary-encapsulation"> 9 <meta name="assert" content="Upper-boundary encapsulation: The nodes and named elements are not accessible from Window object named properties."> 10 <script src="/resources/testharness.js"></script> 11 <script src="/resources/testharnessreport.js"></script> 12 <script src="../../../../html/resources/common.js"></script> 13 </head> 14 <body> 15 <div id="log"></div> 16 <script> 17 function testIDAttribute(elementName) { 18 var doc = document.implementation.createHTMLDocument('Title'); 19 var shadowRoot = doc.body.attachShadow({mode: 'open'}); 20 var element = doc.createElement(elementName); 21 element.id = 'test-id'; 22 shadowRoot.appendChild(element); 23 assert_false('test-id' in window); 24 } 25 26 var idAttributeTestParameter = HTML5_ELEMENTS.map(function (elementName) { 27 return [ 28 '"' + elementName + '" element with id attribute in a shadow tree ' + 29 'should not be accessible from window object\'s named property.', 30 elementName 31 ]; 32 }); 33 34 generate_tests(testIDAttribute, idAttributeTestParameter); 35 </script> 36 </body> 37 </html>