Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Unified Diff: LayoutTests/fast/dom/shadow/resources/shadow-dom.js

Issue 1168323002: Support parameter passing for shadow-dom.js's createShadowRoot (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « LayoutTests/fast/dom/shadow/create-shadow-root-with-parameter.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698