Skip to content

Commit

Permalink
Convert deepPath() to composedPath().
Browse files Browse the repository at this point in the history
Event.deepPath() was renamed to composedPath().
See
whatwg/dom#242
  • Loading branch information
Takayoshi Kochi committed May 27, 2016
1 parent fe7696c commit 2b52fb7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<title>Shadow DOM Test - event path</title>
<link rel="author" title="Kazuhito Hokamura" href="mailto:[email protected]">
<link rel="help" href="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#extensions-to-event">
<meta name="assert" content="Extensions to Event Interface: event.deepPath() cross the shadow boundary">
<meta name="assert" content="Extensions to Event Interface: event.composedPath() cross the shadow boundary">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../../html/resources/common.js"></script>
Expand All @@ -22,7 +22,7 @@
<body>
<div id="log"></div>
<script>
var t = async_test('event.deepPath() cross the shadow boundary');
var t = async_test('event.composedPath() cross the shadow boundary');

t.step(unit(function(ctx) {
var doc = newRenderedHTMLDocument(ctx);
Expand All @@ -35,14 +35,14 @@
shadowRoot.appendChild(child);

child.addEventListener('click', t.step_func(function(e) {
assert_equals(e.deepPath().length, 7, 'deepPath().length');
assert_equals(e.deepPath()[0], child, 'deepPath()[0] should be child');
assert_equals(e.deepPath()[1], shadowRoot, 'deepPath()[1] should be shadowRoot');
assert_equals(e.deepPath()[2], host, 'deepPath()[2] should be host');
assert_equals(e.deepPath()[3], doc.body, 'deepPath()[3] should be body');
assert_equals(e.deepPath()[4], doc.documentElement, 'deepPath()[4] should be html');
assert_equals(e.deepPath()[5], doc, 'deepPath()[5] should be document');
assert_equals(e.deepPath()[6], ctx.iframes[0].contentWindow, 'deepPath()[6] should be window');
assert_equals(e.composedPath().length, 7, 'composedPath().length');
assert_equals(e.composedPath()[0], child, 'composedPath()[0] should be child');
assert_equals(e.composedPath()[1], shadowRoot, 'composedPath()[1] should be shadowRoot');
assert_equals(e.composedPath()[2], host, 'composedPath()[2] should be host');
assert_equals(e.composedPath()[3], doc.body, 'composedPath()[3] should be body');
assert_equals(e.composedPath()[4], doc.documentElement, 'composedPath()[4] should be html');
assert_equals(e.composedPath()[5], doc, 'composedPath()[5] should be document');
assert_equals(e.composedPath()[6], ctx.iframes[0].contentWindow, 'composedPath()[6] should be window');

t.done();
}));
Expand Down
24 changes: 12 additions & 12 deletions shadow-dom/untriaged/events/event-dispatch/test-003.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@
s.appendChild(input2);

input1.addEventListener('focusin', A_05_05_03_T01.step_func(function(event) {
assert_equals(event.deepPath().length, 7);
assert_equals(event.deepPath()[0].id, 'input1');
assert_equals(event.deepPath()[1].id, 'shadow');
assert_equals(event.deepPath()[2].id, 'host');
assert_equals(event.deepPath()[3].tagName, 'BODY');
assert_equals(event.deepPath()[4].tagName, 'HTML');
assert_equals(event.deepPath()[5], d);
assert_equals(event.deepPath()[6], ctx.iframes[0].contentWindow);
assert_equals(event.composedPath().length, 7);
assert_equals(event.composedPath()[0].id, 'input1');
assert_equals(event.composedPath()[1].id, 'shadow');
assert_equals(event.composedPath()[2].id, 'host');
assert_equals(event.composedPath()[3].tagName, 'BODY');
assert_equals(event.composedPath()[4].tagName, 'HTML');
assert_equals(event.composedPath()[5], d);
assert_equals(event.composedPath()[6], ctx.iframes[0].contentWindow);
}), false);

input2.addEventListener('focusin', A_05_05_03_T01.step_func(function(event) {
assert_equals(event.deepPath().length, 2);
assert_equals(event.deepPath()[0].id, 'input2');
assert_equals(event.deepPath()[1].id, 'shadow');
assert_equals(event.composedPath().length, 2);
assert_equals(event.composedPath()[0].id, 'input2');
assert_equals(event.composedPath()[1].id, 'shadow');
A_05_05_03_T01.done();
}), false);

Expand All @@ -70,7 +70,7 @@
// In this case, original relatedTarget is #input1, and original target
// is #input2.
// It should be viewed outside the shadow as "target == relatedTarget"
// after event retargeting, therefore, event.deepPath() above the shadow
// after event retargeting, therefore, event.composedPath() above the shadow
// host will be trimmed.
// Expected event path for #input2:
// <input>, #shadow-root
Expand Down

0 comments on commit 2b52fb7

Please sign in to comment.