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

Side by Side Diff: LayoutTests/fast/dom/shadow/resources/shadow-dom.js

Issue 935283002: Rename {Author,UserAgent}ShadowRoot to {Open,Closed}ShadowRoot. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix inspector tests Created 5 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 function createShadowRoot() 1 function createShadowRoot()
2 { 2 {
3 var children = Array.prototype.slice.call(arguments); 3 var children = Array.prototype.slice.call(arguments);
4 if ((children[0] instanceof Object) && !(children[0] instanceof Node)) 4 if ((children[0] instanceof Object) && !(children[0] instanceof Node))
5 return {'isShadowRoot': true, 5 return {'isShadowRoot': true,
6 'attributes': children[0], 6 'attributes': children[0],
7 'children': children.slice(1)}; 7 'children': children.slice(1)};
8 return {'isShadowRoot': true, 8 return {'isShadowRoot': true,
9 'children': children}; 9 'children': children};
10 } 10 }
11 11
12 function createUserAgentShadowRoot() 12 function createClosedShadowRoot()
13 { 13 {
14 var shadowRoot = createShadowRoot.apply(null, arguments); 14 var shadowRoot = createShadowRoot.apply(null, arguments);
15 shadowRoot.isUserAgentShadowRoot = true; 15 shadowRoot.isClosedShadowRoot = true;
16 return shadowRoot; 16 return shadowRoot;
17 } 17 }
18 18
19 // This function can take optional child elements, which might be a result of cr eateShadowRoot(), as arguments[2:]. 19 // This function can take optional child elements, which might be a result of cr eateShadowRoot(), as arguments[2:].
20 function createDOM(tagName, attributes) 20 function createDOM(tagName, attributes)
21 { 21 {
22 var element = document.createElement(tagName); 22 var element = document.createElement(tagName);
23 for (var name in attributes) 23 for (var name in attributes)
24 element.setAttribute(name, attributes[name]); 24 element.setAttribute(name, attributes[name]);
25 var childElements = Array.prototype.slice.call(arguments, 2); 25 var childElements = Array.prototype.slice.call(arguments, 2);
26 for (var i = 0; i < childElements.length; ++i) { 26 for (var i = 0; i < childElements.length; ++i) {
27 var child = childElements[i]; 27 var child = childElements[i];
28 if (child.isShadowRoot) { 28 if (child.isShadowRoot) {
29 var shadowRoot; 29 var shadowRoot;
30 if (child.isUserAgentShadowRoot) { 30 if (child.isClosedShadowRoot) {
31 shadowRoot = window.internals.createUserAgentShadowRoot(element) ; 31 shadowRoot = window.internals.createClosedShadowRoot(element);
32 } else { 32 } else {
33 shadowRoot = element.createShadowRoot(); 33 shadowRoot = element.createShadowRoot();
34 } 34 }
35 if (child.attributes) { 35 if (child.attributes) {
36 for (var attribute in child.attributes) { 36 for (var attribute in child.attributes) {
37 // Shadow Root does not have setAttribute. 37 // Shadow Root does not have setAttribute.
38 shadowRoot[attribute] = child.attributes[attribute]; 38 shadowRoot[attribute] = child.attributes[attribute];
39 } 39 }
40 } 40 }
41 for (var j = 0; j < child.children.length; ++j) 41 for (var j = 0; j < child.children.length; ++j)
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 debug('Traverse in backward.'); 242 debug('Traverse in backward.');
243 showComposedShadowTreeByTraversingInBackward(node); 243 showComposedShadowTreeByTraversingInBackward(node);
244 244
245 debug(''); 245 debug('');
246 } 246 }
247 247
248 function showNextNode(node) { 248 function showNextNode(node) {
249 var next = internals.nextInComposedTree(node); 249 var next = internals.nextInComposedTree(node);
250 debug('Next node of [' + dumpNode(node) + '] is [' + dumpNode(next) + ']'); 250 debug('Next node of [' + dumpNode(node) + '] is [' + dumpNode(next) + ']');
251 } 251 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698