test-002.html (1487B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Shadow DOM Test: A_07_03_02</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: Document's activeElement property must be adjusted"> 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 host.setAttribute('id', 'shRoot'); 21 d.body.appendChild(host); 22 var s = host.attachShadow({mode: 'open'}); 23 24 var inp = d.createElement('input'); 25 inp.setAttribute('type', 'text'); 26 inp.setAttribute('id', 'inpId'); 27 inp.setAttribute('value', 'Some text'); 28 s.appendChild(inp); 29 30 inp.focus(); 31 32 assert_equals(d.activeElement.tagName, 'DIV', 'Point 1: document\'s activeElement property ' + 33 'must return adjusted the value of the focused element in the shadow tree'); 34 assert_equals(d.activeElement.getAttribute('id'), 'shRoot', 'Point 2: document\'s activeElement property ' + 35 'must return adjusted the value of the focused element in the shadow tree'); 36 37 }), 'A_07_03_02_T01'); 38 </script> 39 </body> 40 </html>