| Index: third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js
|
| diff --git a/third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js b/third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js
|
| index 488283fcb35c6f79cab84a9c447d54cc78985d1d..7aeb5fc875eda3d4f2a0ed8470f8ab421ec8db0f 100644
|
| --- a/third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js
|
| +++ b/third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js
|
| @@ -128,6 +128,36 @@ function dispatchEventWithLog(nodes, target, event) {
|
| return log;
|
| }
|
|
|
| +function dispatchUAEventWithLog(nodes, target, eventType, callback) {
|
| +
|
| + function labelFor(e) {
|
| + return e.id || e.tagName;
|
| + }
|
| +
|
| + let log = [];
|
| + let attachedNodes = [];
|
| + for (let label in nodes) {
|
| + let startingNode = nodes[label];
|
| + for (let node = startingNode; node; node = node.parentNode) {
|
| + if (attachedNodes.indexOf(node) >= 0)
|
| + continue;
|
| + let id = node.id;
|
| + if (!id)
|
| + continue;
|
| + attachedNodes.push(node);
|
| + node.addEventListener(eventType, (e) => {
|
| + log.push([id,
|
| + event.relatedTarget ? labelFor(event.relatedTarget) : null,
|
| + event.composedPath().map((n) => {
|
| + return labelFor(n);
|
| + })]);
|
| + });
|
| + }
|
| + }
|
| + callback(target);
|
| + return log;
|
| +}
|
| +
|
| // This function assumes that testharness.js is available.
|
| function assert_event_path_equals(actual, expected) {
|
| assert_equals(actual.length, expected.length);
|
|
|