test-007.html (1487B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Shadow DOM Test: A_10_01_01_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/#shadow-root-attributes"> 7 <meta name="assert" content="ShadowRoot Object: readonly attribute Element? activeElement; actual value"> 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 18 var d = newRenderedHTMLDocument(ctx); 19 20 var host = d.createElement('div'); 21 host.setAttribute('id', 'shRoot'); 22 d.body.appendChild(host); 23 var s = host.attachShadow({mode: 'open'}); 24 25 var inp = d.createElement('input'); 26 inp.setAttribute('type', 'text'); 27 inp.setAttribute('id', 'inpId'); 28 inp.setAttribute('value', 'Some text'); 29 s.appendChild(inp); 30 31 inp.focus(); 32 33 assert_true(s.activeElement != null, 'Point 1: activeElement attribute of the ShadowRoot ' + 34 'must return the currently focused element in the shadow tree'); 35 assert_equals(s.activeElement.tagName, 'INPUT', 'Point 2: activeElement attribute of the ShadowRoot ' + 36 'must return the currently focused element in the shadow tree'); 37 38 }), 'A_10_01_01_03_01_T01'); 39 </script> 40 </body> 41 </html>