test-001.html (1498B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Shadow DOM Test: A_07_03_01</title> 5 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> 6 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#active-element"> 7 <meta name="assert" content="User Interaction: each shadow root must also have an activeElement property to store the value of the focused element in the shadow tree."> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="../../../../html/resources/common.js"></script> 11 <script src="../../../resources/shadow-dom-utils.js"></script> 12 </head> 13 <body> 14 <div id="log"></div> 15 <script> 16 test(unit(function (ctx) { 17 var d = newRenderedHTMLDocument(ctx); 18 19 var host = d.createElement('div'); 20 d.body.appendChild(host); 21 var s = host.attachShadow({mode: 'open'}); 22 23 var inp = d.createElement('input'); 24 inp.setAttribute('type', 'text'); 25 inp.setAttribute('id', 'inpId'); 26 inp.setAttribute('value', 'Some text'); 27 s.appendChild(inp); 28 29 inp.focus(); 30 31 assert_equals(s.activeElement.tagName, 'INPUT', 'Point 1:activeElement property of shadow root ' + 32 'must return the value of the focused element in the shadow tree'); 33 assert_equals(s.activeElement.getAttribute('id'), 'inpId', 'Point 2:activeElement property of shadow root ' + 34 'must return the value of the focused element in the shadow tree'); 35 36 }), 'A_07_03_01_T01'); 37 </script> 38 </body> 39 </html>