Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(806)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/inert/inert-in-shadow-dom.html

Issue 2088453002: Implement the inert attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert histograms.xml Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 id="shadow-host">
10 <button slot="slot-1" id="button-1">Button 1 (inert)</button>
11 <button slot="slot-2" id="button-2">Button 2 (not inert)</button>
12 </div>
13 <script>
14 const shadowHost = document.getElementById('shadow-host');
15 const shadowRoot = shadowHost.attachShadow({ mode: 'open' });
16 const inertDiv = document.createElement('div');
17 inertDiv.inert = true;
18 shadowRoot.appendChild(inertDiv);
19 const slot1 = document.createElement('slot');
20 slot1.name = 'slot-1';
21 inertDiv.appendChild(slot1);
22 const slot2 = document.createElement('slot');
23 slot2.name = 'slot-2';
24 shadowRoot.appendChild(slot2);
25
26 function testCanFocus(selector, canFocus) {
27 const element = document.querySelector(selector);
28 let focusedElement = null;
29 element.addEventListener('focus', function() { focusedElement = element; } , false);
30 element.focus();
31 if (canFocus)
32 assert_true(focusedElement === element);
33 else
34 assert_false(focusedElement === element);
35 }
36
37 testCanFocus('#button-1', false);
38 testCanFocus('#button-2', true);
39 done();
40 </script>
41 </body>
42 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698