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

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

Issue 1773553003: Removing dependency on js-test.js from shadow-dom.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a clarification comment Created 4 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/shadow/tabindex-slot.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // TODO(yuzus): These two functions below need cleaning up. They are currently
2 // from js-test.js.
3 function getOrCreateTestElement(id, tagName)
4 {
5 var element = document.getElementById(id);
6 if (element)
7 return element;
8
9 element = document.createElement(tagName);
10 element.id = id;
11 var refNode;
12 var parent = document.body || document.documentElement;
13 if (id == "description")
14 refNode = getOrCreateTestElement("console", "div");
15 else
16 refNode = parent.firstChild;
17
18 parent.insertBefore(element, refNode);
19 return element;
20 }
21
22 function debug(msg)
23 {
24 if (self._lazyTestResults) {
25 self._lazyTestResults.push(msg);
26 } else {
27 var span = document.createElement("span");
28 // insert it first so XHTML knows the namespace;
29 getOrCreateTestElement("console", "div").appendChild(span);
30 span.innerHTML = msg + '<br />';
31 };
32 }
33
34
1 function createShadowRoot() 35 function createShadowRoot()
2 { 36 {
3 var children = Array.prototype.slice.call(arguments); 37 var children = Array.prototype.slice.call(arguments);
4 if ((children[0] instanceof Object) && !(children[0] instanceof Node)) 38 if ((children[0] instanceof Object) && !(children[0] instanceof Node))
5 return attachShadow.apply(null, children); 39 return attachShadow.apply(null, children);
6 return {'isShadowRoot': true, 40 return {'isShadowRoot': true,
7 'children': children}; 41 'children': children};
8 } 42 }
9 43
10 // TODO(kochi): This is not pure attachShadow wrapper, but also handles createSh adowRoot() 44 // TODO(kochi): This is not pure attachShadow wrapper, but also handles createSh adowRoot()
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 return; 254 return;
221 } 255 }
222 if (direction == 'forward') 256 if (direction == 'forward')
223 navigateFocusForward(); 257 navigateFocusForward();
224 else 258 else
225 navigateFocusBackward(); 259 navigateFocusBackward();
226 if (isInnermostActiveElement(to)) 260 if (isInnermostActiveElement(to))
227 debug('PASS'); 261 debug('PASS');
228 else 262 else
229 debug('FAIL'); 263 debug('FAIL');
264 return isInnermostActiveElement(to);
230 } 265 }
231 266
232 function navigateFocusForward() 267 function navigateFocusForward()
233 { 268 {
234 eventSender.keyDown('\t'); 269 eventSender.keyDown('\t');
235 } 270 }
236 271
237 function navigateFocusBackward() 272 function navigateFocusBackward()
238 { 273 {
239 eventSender.keyDown('\t', ['shiftKey']); 274 eventSender.keyDown('\t', ['shiftKey']);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 return node; 389 return node;
355 } 390 }
356 391
357 return null; 392 return null;
358 }; 393 };
359 394
360 if (!window.internals) 395 if (!window.internals)
361 return null; 396 return null;
362 return iter(root, id); 397 return iter(root, id);
363 } 398 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/shadow/tabindex-slot.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698