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

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: Fix for comment, and update test expectation. 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-expected.txt ('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..61a8f7d49060e56d41ad53edaf04d266990dcd43 100644
--- a/LayoutTests/fast/dom/shadow/resources/shadow-dom.js
+++ b/LayoutTests/fast/dom/shadow/resources/shadow-dom.js
@@ -1,10 +1,20 @@
function createShadowRoot()
{
var children = Array.prototype.slice.call(arguments);
- if ((children[0] instanceof Object) && !(children[0] instanceof Node))
+ 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];
+ }
return {'isShadowRoot': true,
- 'attributes': children[0],
+ 'parameter': parameter,
+ 'attributes': attributes,
'children': children.slice(1)};
+ }
return {'isShadowRoot': true,
'children': children};
}
@@ -30,7 +40,10 @@ function createDOM(tagName, attributes)
if (child.isUserAgentShadowRoot) {
shadowRoot = window.internals.createUserAgentShadowRoot(element);
} else {
- shadowRoot = element.createShadowRoot();
+ if (child.parameter && Object.keys(child.parameter).length > 0)
+ 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-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698