| Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/untriaged/events/retargeting-focus-events/test-001.html
|
| diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/untriaged/events/retargeting-focus-events/test-001.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/untriaged/events/retargeting-focus-events/test-001.html
|
| index 44cc04c809aabf305253d324618aa67f7f829849..096ff6684ed6b33db43233feccac6711f84a2c57 100644
|
| --- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/untriaged/events/retargeting-focus-events/test-001.html
|
| +++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/untriaged/events/retargeting-focus-events/test-001.html
|
| @@ -16,7 +16,8 @@ policies and contribution forms [3].
|
| <meta name="assert" content="Retargeting focus events:The focus, DOMFocusIn, blur, and DOMFocusOut events must be treated in the same way as events with a relatedTarget, where the corresponding node that is losing focus as a result of target gaining focus or the node that is gaining focus, and thus causing the blurring of target acts as the related target">
|
| <script src="../../../../../../resources/testharness.js"></script>
|
| <script src="../../../../../../resources/testharnessreport.js"></script>
|
| -<script src="../../testcommon.js"></script>
|
| +<script src="../../../../html/resources/common.js"></script>
|
| +<script src="../../../resources/shadow-dom-utils.js"></script>
|
| </head>
|
| <body>
|
| <div id="log"></div>
|
| @@ -37,7 +38,7 @@ A_05_03_01_T01.step(unit(function (ctx) {
|
| d.body.appendChild(host);
|
|
|
| //Shadow root to play with
|
| - var s = host.createShadowRoot();
|
| + var s = host.attachShadow({mode: 'open'});
|
|
|
| var inp1 = d.createElement('input');
|
| inp1.setAttribute('id', 'inp1');
|
| @@ -50,11 +51,11 @@ A_05_03_01_T01.step(unit(function (ctx) {
|
| d.body.appendChild(inp2);
|
|
|
| s.addEventListener('DOMFocusOut', A_05_03_01_T01.step_func(function(event) {
|
| - assert_equals(event.target.getAttribute('id'), 'inp1', 'Inside shadow tree: Wrong target');
|
| + assert_equals(event.target.getAttribute('id'), 'inp1', 'Inside shadow tree: Wrong target');
|
| }), false);
|
|
|
| d.body.addEventListener('DOMFocusOut', A_05_03_01_T01.step_func(function(event) {
|
| - assert_equals(event.target.getAttribute('id'), 'host', 'Inside shadow tree: Wrong target');
|
| + assert_equals(event.target.getAttribute('id'), 'host', 'Inside shadow tree: Wrong target');
|
| }), false);
|
|
|
| inp1.focus();
|
| @@ -77,7 +78,7 @@ A_05_03_01_T02.step(unit(function (ctx) {
|
| d.body.appendChild(host);
|
|
|
| //Shadow root to play with
|
| - var s = host.createShadowRoot();
|
| + var s = host.attachShadow({mode: 'open'});
|
|
|
| var inp1 = d.createElement('input');
|
| inp1.setAttribute('id', 'inp1');
|
| @@ -92,11 +93,11 @@ A_05_03_01_T02.step(unit(function (ctx) {
|
| inp2.focus();
|
|
|
| s.addEventListener('DOMFocusIn', A_05_03_01_T02.step_func(function(event) {
|
| - assert_equals(event.target.getAttribute('id'), 'inp1', 'Inside shadoe tree: Wrong target');
|
| + assert_equals(event.target.getAttribute('id'), 'inp1', 'Inside shadoe tree: Wrong target');
|
| }), false);
|
|
|
| d.body.addEventListener('DOMFocusIn', A_05_03_01_T02.step_func(function(event) {
|
| - assert_equals(event.target.getAttribute('id'), 'host', 'Outside shadow tree: Wrong target');
|
| + assert_equals(event.target.getAttribute('id'), 'host', 'Outside shadow tree: Wrong target');
|
| }), false);
|
|
|
| inp1.focus();
|
| @@ -120,7 +121,7 @@ A_05_03_01_T03.step(unit(function (ctx) {
|
| d.body.appendChild(host);
|
|
|
| //Shadow root to play with
|
| - var s = host.createShadowRoot();
|
| + var s = host.attachShadow({mode: 'open'});
|
|
|
| var inp1 = d.createElement('input');
|
| inp1.setAttribute('id', 'inp1');
|
| @@ -135,7 +136,7 @@ A_05_03_01_T03.step(unit(function (ctx) {
|
| inp1.focus();
|
|
|
| d.body.addEventListener('DOMFocusIn', A_05_03_01_T03.step_func(function(event) {
|
| - assert_true(false, 'Event should be stopped at Shadow boundary');
|
| + assert_true(false, 'Event should be stopped at Shadow boundary');
|
| }), false);
|
|
|
| inp2.focus();
|
| @@ -152,35 +153,35 @@ var A_05_03_01_T04 = async_test('A_05_03_01_T04');
|
|
|
| A_05_03_01_T04.step(unit(function (ctx) {
|
|
|
| - var d = newRenderedHTMLDocument(ctx);
|
| + var d = newRenderedHTMLDocument(ctx);
|
|
|
| - var host = d.createElement('div');
|
| - host.setAttribute('style', 'height:50%; width:100%');
|
| - host.setAttribute('id', 'host');
|
| - d.body.appendChild(host);
|
| + var host = d.createElement('div');
|
| + host.setAttribute('style', 'height:50%; width:100%');
|
| + host.setAttribute('id', 'host');
|
| + d.body.appendChild(host);
|
|
|
| - //Shadow root to play with
|
| - var s = host.createShadowRoot();
|
| + //Shadow root to play with
|
| + var s = host.attachShadow({mode: 'open'});
|
|
|
| - var inp1 = d.createElement('input');
|
| - inp1.setAttribute('id', 'inp1');
|
| - inp1.setAttribute('type', 'checkbox');
|
| - s.appendChild(inp1);
|
| + var inp1 = d.createElement('input');
|
| + inp1.setAttribute('id', 'inp1');
|
| + inp1.setAttribute('type', 'checkbox');
|
| + s.appendChild(inp1);
|
|
|
| - var inp2 = d.createElement('input');
|
| - inp2.setAttribute('id', 'inp2');
|
| - inp2.setAttribute('type', 'checkbox');
|
| - s.appendChild(inp2);
|
| + var inp2 = d.createElement('input');
|
| + inp2.setAttribute('id', 'inp2');
|
| + inp2.setAttribute('type', 'checkbox');
|
| + s.appendChild(inp2);
|
|
|
| - inp1.focus();
|
| + inp1.focus();
|
|
|
| - d.body.addEventListener('DOMFocusOut', A_05_03_01_T04.step_func(function(event) {
|
| - assert_true(false, 'Event should be stopped at Shadow boundary');
|
| - }), false);
|
| + d.body.addEventListener('DOMFocusOut', A_05_03_01_T04.step_func(function(event) {
|
| + assert_true(false, 'Event should be stopped at Shadow boundary');
|
| + }), false);
|
|
|
| - inp2.focus();
|
| + inp2.focus();
|
|
|
| - A_05_03_01_T04.done();
|
| + A_05_03_01_T04.done();
|
| }));
|
|
|
|
|
| @@ -192,63 +193,63 @@ var A_05_03_01_T05 = async_test('A_05_03_01_T05');
|
|
|
| A_05_03_01_T05.step(unit(function (ctx) {
|
|
|
| - var d = newRenderedHTMLDocument(ctx);
|
| + var d = newRenderedHTMLDocument(ctx);
|
|
|
| - var host = d.createElement('div');
|
| - host.setAttribute('id', 'host');
|
| - d.body.appendChild(host);
|
| + var host = d.createElement('div');
|
| + host.setAttribute('id', 'host');
|
| + d.body.appendChild(host);
|
|
|
| - var inp1 = d.createElement('input');
|
| - inp1.setAttribute('id', 'inp1');
|
| - inp1.setAttribute('type', 'checkbox');
|
| - inp1.setAttribute('class', 'clazz1');
|
| - host.appendChild(inp1);
|
| + var inp1 = d.createElement('input');
|
| + inp1.setAttribute('id', 'inp1');
|
| + inp1.setAttribute('type', 'checkbox');
|
| + inp1.setAttribute('slot', 'slot1');
|
| + host.appendChild(inp1);
|
|
|
| - var inp2 = d.createElement('input');
|
| - inp2.setAttribute('id', 'inp2');
|
| - inp2.setAttribute('type', 'checkbox');
|
| - inp2.setAttribute('class', 'clazz2');
|
| - host.appendChild(inp2);
|
| + var inp2 = d.createElement('input');
|
| + inp2.setAttribute('id', 'inp2');
|
| + inp2.setAttribute('type', 'checkbox');
|
| + inp2.setAttribute('slot', 'slot2');
|
| + host.appendChild(inp2);
|
|
|
| - var inp3 = d.createElement('input');
|
| - inp3.setAttribute('id', 'inp3');
|
| - inp3.setAttribute('type', 'checkbox');
|
| - inp3.setAttribute('class', 'clazz1');
|
| - host.appendChild(inp3);
|
| + var inp3 = d.createElement('input');
|
| + inp3.setAttribute('id', 'inp3');
|
| + inp3.setAttribute('type', 'checkbox');
|
| + inp3.setAttribute('slot', 'slot1');
|
| + host.appendChild(inp3);
|
|
|
|
|
| - //Shadow root to play with
|
| - var s = host.createShadowRoot();
|
| + //Shadow root to play with
|
| + var s = host.attachShadow({mode: 'open'});
|
|
|
| - var shadowDiv = document.createElement('div');
|
| - shadowDiv.innerHTML = '<content select=".clazz1"></content>';
|
| - s.appendChild(shadowDiv);
|
| + var shadowDiv = document.createElement('div');
|
| + shadowDiv.innerHTML = '<slot name="slot1"></slot>';
|
| + s.appendChild(shadowDiv);
|
|
|
| - //element outside the shadow tree
|
| - var inp4 = d.createElement('input');
|
| - inp4.setAttribute('id', 'inp4');
|
| - inp4.setAttribute('type', 'checkbox');
|
| - inp4.setAttribute('class', 'clazz1');
|
| - d.body.appendChild(inp4);
|
| + //element outside the shadow tree
|
| + var inp4 = d.createElement('input');
|
| + inp4.setAttribute('id', 'inp4');
|
| + inp4.setAttribute('type', 'checkbox');
|
| + inp4.setAttribute('slot', 'slot1');
|
| + d.body.appendChild(inp4);
|
|
|
| - inp1.focus();
|
| + inp1.focus();
|
|
|
| - s.addEventListener('DOMFocusOut', A_05_03_01_T05.step_func(function(event) {
|
| - assert_equals(event.target.getAttribute('id'), 'inp1', 'Inside shadow tree: ' +
|
| - 'Event for nodes, distributed ' +
|
| - 'agains insertion points shouldn\'t be retargeted');
|
| - }), false);
|
| + s.addEventListener('DOMFocusOut', A_05_03_01_T05.step_func(function(event) {
|
| + assert_equals(event.target.getAttribute('id'), 'inp1', 'Inside shadow tree: ' +
|
| + 'Event for nodes, distributed ' +
|
| + 'agains insertion points shouldn\'t be retargeted');
|
| + }), false);
|
|
|
|
|
| - d.body.addEventListener('DOMFocusOut', A_05_03_01_T05.step_func(function(event) {
|
| - assert_equals(event.target.getAttribute('id'), 'inp1', 'Outside shadow tree: ' +
|
| - 'Event for nodes, distributed ' +
|
| - 'agains insertion points shouldn\'t be retargeted');
|
| - }), false);
|
| + d.body.addEventListener('DOMFocusOut', A_05_03_01_T05.step_func(function(event) {
|
| + assert_equals(event.target.getAttribute('id'), 'inp1', 'Outside shadow tree: ' +
|
| + 'Event for nodes, distributed ' +
|
| + 'agains insertion points shouldn\'t be retargeted');
|
| + }), false);
|
|
|
| - inp4.focus();
|
| + inp4.focus();
|
|
|
| - A_05_03_01_T05.done();
|
| + A_05_03_01_T05.done();
|
| }));
|
|
|
|
|
| @@ -258,63 +259,63 @@ var A_05_03_01_T06 = async_test('A_05_03_01_T06');
|
|
|
| A_05_03_01_T06.step(unit(function (ctx) {
|
|
|
| - var d = newRenderedHTMLDocument(ctx);
|
| + var d = newRenderedHTMLDocument(ctx);
|
|
|
| - var host = d.createElement('div');
|
| - host.setAttribute('id', 'host');
|
| - d.body.appendChild(host);
|
| + var host = d.createElement('div');
|
| + host.setAttribute('id', 'host');
|
| + d.body.appendChild(host);
|
|
|
| - var inp1 = d.createElement('input');
|
| - inp1.setAttribute('id', 'inp1');
|
| - inp1.setAttribute('type', 'checkbox');
|
| - inp1.setAttribute('class', 'clazz1');
|
| - host.appendChild(inp1);
|
| + var inp1 = d.createElement('input');
|
| + inp1.setAttribute('id', 'inp1');
|
| + inp1.setAttribute('type', 'checkbox');
|
| + inp1.setAttribute('slot', 'slot1');
|
| + host.appendChild(inp1);
|
|
|
| - var inp2 = d.createElement('input');
|
| - inp2.setAttribute('id', 'inp2');
|
| - inp2.setAttribute('type', 'checkbox');
|
| - inp2.setAttribute('class', 'clazz2');
|
| - host.appendChild(inp2);
|
| + var inp2 = d.createElement('input');
|
| + inp2.setAttribute('id', 'inp2');
|
| + inp2.setAttribute('type', 'checkbox');
|
| + inp2.setAttribute('slot', 'slot2');
|
| + host.appendChild(inp2);
|
|
|
| - var inp3 = d.createElement('input');
|
| - inp3.setAttribute('id', 'inp3');
|
| - inp3.setAttribute('type', 'checkbox');
|
| - inp3.setAttribute('class', 'clazz1');
|
| - host.appendChild(inp3);
|
| + var inp3 = d.createElement('input');
|
| + inp3.setAttribute('id', 'inp3');
|
| + inp3.setAttribute('type', 'checkbox');
|
| + inp3.setAttribute('slot', 'slot1');
|
| + host.appendChild(inp3);
|
|
|
|
|
| - //Shadow root to play with
|
| - var s = host.createShadowRoot();
|
| + //Shadow root to play with
|
| + var s = host.attachShadow({mode: 'open'});
|
|
|
| - var shadowDiv = document.createElement('div');
|
| - shadowDiv.innerHTML = '<content select=".clazz1"></content>';
|
| - s.appendChild(shadowDiv);
|
| + var shadowDiv = document.createElement('div');
|
| + shadowDiv.innerHTML = '<slot name="slot1"></slot>';
|
| + s.appendChild(shadowDiv);
|
|
|
| - //element outside the shadow tree
|
| - var inp4 = d.createElement('input');
|
| - inp4.setAttribute('id', 'inp4');
|
| - inp4.setAttribute('type', 'checkbox');
|
| - inp4.setAttribute('class', 'clazz1');
|
| - d.body.appendChild(inp4);
|
| + //element outside the shadow tree
|
| + var inp4 = d.createElement('input');
|
| + inp4.setAttribute('id', 'inp4');
|
| + inp4.setAttribute('type', 'checkbox');
|
| + inp4.setAttribute('slot', 'slot1');
|
| + d.body.appendChild(inp4);
|
|
|
| - inp4.focus();
|
| + inp4.focus();
|
|
|
| - s.addEventListener('DOMFocusIn', A_05_03_01_T06.step_func(function(event) {
|
| - assert_equals(event.target.getAttribute('id'), 'inp1', 'Inside shadow tree: ' +
|
| - 'Event for nodes, distributed ' +
|
| - 'agains insertion points shouldn\'t be retargeted');
|
| - }), false);
|
| + s.addEventListener('DOMFocusIn', A_05_03_01_T06.step_func(function(event) {
|
| + assert_equals(event.target.getAttribute('id'), 'inp1', 'Inside shadow tree: ' +
|
| + 'Event for nodes, distributed ' +
|
| + 'agains insertion points shouldn\'t be retargeted');
|
| + }), false);
|
|
|
|
|
| - d.body.addEventListener('DOMFocusIn', A_05_03_01_T05.step_func(function(event) {
|
| - assert_equals(event.target.getAttribute('id'), 'inp1', 'Outside shadow tree: ' +
|
| - 'Event for nodes, distributed ' +
|
| - 'agains insertion points shouldn\'t be retargeted');
|
| - }), false);
|
| + d.body.addEventListener('DOMFocusIn', A_05_03_01_T05.step_func(function(event) {
|
| + assert_equals(event.target.getAttribute('id'), 'inp1', 'Outside shadow tree: ' +
|
| + 'Event for nodes, distributed ' +
|
| + 'agains insertion points shouldn\'t be retargeted');
|
| + }), false);
|
|
|
| - inp1.focus();
|
| + inp1.focus();
|
|
|
| - A_05_03_01_T06.done();
|
| + A_05_03_01_T06.done();
|
| }));
|
| </script>
|
| </body>
|
|
|