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 7b4841fb571d55c4bb83db470d6140107bb12278..488283fcb35c6f79cab84a9c447d54cc78985d1d 100644 |
--- a/third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js |
+++ b/third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js |
@@ -67,27 +67,27 @@ function getNodeInComposedTree(path) |
function createTestTree(node) { |
- let labels = {}; |
+ let ids = {}; |
function attachShadowFromTemplate(template) { |
let parent = template.parentNode; |
parent.removeChild(template); |
let shadowRoot = parent.attachShadow({mode: template.getAttribute('data-mode')}); |
- let label = template.getAttribute('label'); |
- if (label) { |
- shadowRoot.id = label; |
- labels[label] = shadowRoot; |
+ let id = template.id; |
+ if (id) { |
+ shadowRoot.id = id; |
+ ids[id] = shadowRoot; |
} |
shadowRoot.appendChild(document.importNode(template.content, true)); |
return shadowRoot; |
} |
function walk(root) { |
- if (root.getAttribute && root.getAttribute('label')) { |
- labels[root.getAttribute('label')] = root; |
+ if (root.id) { |
+ ids[root.id] = root; |
} |
- for (let e of Array.from(root.querySelectorAll('[label]'))) { |
- labels[e.getAttribute('label')] = e; |
+ for (let e of Array.from(root.querySelectorAll('[id]'))) { |
+ ids[e.id] = e; |
} |
for (let e of Array.from(root.querySelectorAll('template'))) { |
walk(attachShadowFromTemplate(e)); |
@@ -95,15 +95,12 @@ function createTestTree(node) { |
} |
walk(node.cloneNode(true)); |
- return labels; |
+ return ids; |
} |
function dispatchEventWithLog(nodes, target, event) { |
function labelFor(e) { |
- if (e.getAttribute && e.getAttribute('label')) { |
- return e.getAttribute('label'); |
- } |
return e.id || e.tagName; |
} |
@@ -114,12 +111,12 @@ function dispatchEventWithLog(nodes, target, event) { |
for (let node = startingNode; node; node = node.parentNode) { |
if (attachedNodes.indexOf(node) >= 0) |
continue; |
- let label = labelFor(node); |
- if (!label) |
+ let id = node.id; |
+ if (!id) |
continue; |
attachedNodes.push(node); |
node.addEventListener(event.type, (e) => { |
- log.push([label, |
+ log.push([id, |
event.relatedTarget ? labelFor(event.relatedTarget) : null, |
event.composedPath().map((n) => { |
return labelFor(n); |