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 c11861a1321ad0fb2cd6a5336233d5f9105bb0b8..65d05966661db95fa33bdac1d860531750f3b652 100644 |
--- a/third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js |
+++ b/third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js |
@@ -72,7 +72,13 @@ function createTestTree(node) { |
function attachShadowFromTemplate(template) { |
let parent = template.parentNode; |
parent.removeChild(template); |
- let shadowRoot = parent.attachShadow({mode: template.getAttribute('data-mode')}); |
+ let shadowRoot; |
+ if (template.getAttribute('data-mode') === 'v0') { |
+ // For legacy Shadow DOM |
+ shadowRoot = parent.createShadowRoot(); |
+ } else { |
+ shadowRoot = parent.attachShadow({mode: template.getAttribute('data-mode')}); |
+ } |
let id = template.id; |
if (id) { |
shadowRoot.id = id; |
@@ -158,6 +164,26 @@ function dispatchUAEventWithLog(nodes, target, eventType, callback) { |
return log; |
} |
+function makeExpectedEventPathLog(path) { |
+ let expectedLog = []; |
+ for (let i of path) { |
+ expectedLog.push([i, null, path]); |
+ } |
+ return expectedLog; |
+} |
+ |
+function debugEventLog(log) { |
+ for (let i = 0; i < log.length; i++) { |
+ console.log('[' + i + '] currentTarget: ' + log[i][0] + ' relatedTarget: ' + log[i][1] + ' composedPath(): ' + log[i][2]); |
+ } |
+} |
+ |
+function debugCreateTestTree(nodes) { |
+ for (let k in nodes) { |
+ console.log(k + ' -> ' + nodes[k]); |
+ } |
+} |
+ |
// This function assumes that testharness.js is available. |
function assert_event_path_equals(actual, expected) { |
assert_equals(actual.length, expected.length); |