OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../resources/testharness.js"></script> |
| 5 <script src="../../../resources/testharnessreport.js"></script> |
| 6 </head> |
| 7 <body> |
| 8 |
| 9 <div inert> |
| 10 <iframe height=400 width=600 id="main-iframe"> |
| 11 <frameset rows="*" cols="50,50"> |
| 12 <frame src="resources/inert-focus-in-frames-frame1.html"> |
| 13 <frame src='data:text/html,<div id="frame2-div" class="target" tabindex="0">
Hello</div>'> |
| 14 </frameset> |
| 15 </iframe> |
| 16 </div> |
| 17 |
| 18 <script> |
| 19 setup({ explicit_done: true }); |
| 20 |
| 21 framesLoaded = 0; |
| 22 numFrames = 4; |
| 23 var mainIframe = document.getElementById('main-iframe'); |
| 24 |
| 25 function frameLoaded() { |
| 26 framesLoaded++; |
| 27 if (framesLoaded == numFrames) { |
| 28 test(function() { |
| 29 var frame1 = mainIframe.contentWindow.frames[0].document; |
| 30 var target1 = frame1.querySelector('.target'); |
| 31 testCantFocus(target1); |
| 32 var iframe = frame1.querySelector('iframe').contentDocument; |
| 33 testCantFocus(iframe.querySelector('.target')); |
| 34 }, "Focus can't go into frames or iframes in inert subtree"); |
| 35 done(); |
| 36 } |
| 37 } |
| 38 |
| 39 function testCantFocus(element) { |
| 40 focusedElement = null; |
| 41 element.addEventListener('focus', function() { focusedElement = element; },
false); |
| 42 element.focus(); |
| 43 theElement = element; |
| 44 assert_false(focusedElement === theElement); |
| 45 } |
| 46 |
| 47 mainIframe.contentDocument.write(mainIframe.textContent); |
| 48 mainIframe.contentDocument.close(); |
| 49 |
| 50 mainIframe.contentWindow.frames[1].window.onload = frameLoaded; |
| 51 |
| 52 window.onload = frameLoaded; |
| 53 </script> |
| 54 </body> |
| 55 </html> |
OLD | NEW |