Chromium Code Reviews| Index: LayoutTests/fast/dom/shadow/resources/shadow-dom.js |
| diff --git a/LayoutTests/fast/dom/shadow/resources/shadow-dom.js b/LayoutTests/fast/dom/shadow/resources/shadow-dom.js |
| index 65555417228c62c13ff557f3186ffe767ca2f3f9..aabb1841349dc8f0f3d16900b441bad0aa8b3c24 100644 |
| --- a/LayoutTests/fast/dom/shadow/resources/shadow-dom.js |
| +++ b/LayoutTests/fast/dom/shadow/resources/shadow-dom.js |
| @@ -1,10 +1,22 @@ |
| function createShadowRoot() |
| { |
| var children = Array.prototype.slice.call(arguments); |
| - if ((children[0] instanceof Object) && !(children[0] instanceof Node)) |
| - return {'isShadowRoot': true, |
| - 'attributes': children[0], |
| - 'children': children.slice(1)}; |
| + if ((children[0] instanceof Object) && !(children[0] instanceof Node)) { |
| + var attributes = {}; |
| + var parameter = {}; |
| + for (var key in children[0]) { |
| + if (key == 'mode') |
| + parameter[key] = children[0][key]; |
| + else |
| + attributes[key] = children[0][key]; |
| + } |
| + var obj = {'isShadowRoot': true, |
|
hayato
2015/06/09 04:34:38
Nit: I'd prefer returning obj as is here, e.g. re
kochi
2015/06/09 04:46:57
Done.
|
| + 'attributes': attributes, |
| + 'children': children.slice(1)}; |
| + if (Object.keys(parameter).length > 0) |
| + obj['parameter'] = parameter; |
| + return obj; |
| + } |
| return {'isShadowRoot': true, |
| 'children': children}; |
| } |
| @@ -30,7 +42,10 @@ function createDOM(tagName, attributes) |
| if (child.isUserAgentShadowRoot) { |
| shadowRoot = window.internals.createUserAgentShadowRoot(element); |
| } else { |
| - shadowRoot = element.createShadowRoot(); |
| + if (child.parameter) |
| + shadowRoot = element.createShadowRoot(child.parameter); |
| + else |
| + shadowRoot = element.createShadowRoot(); |
| } |
| if (child.attributes) { |
| for (var attribute in child.attributes) { |