Rename getElementInShadowTreeStack to getNodeInShadowTreeStack
[WebKit-https.git] / LayoutTests / fast / dom / shadow / get-element-by-id-in-shadow-root.html
index d07fa0060d8194676eef9e5203e7ff0fc71b6a93..14ffde3be3284b08db172a8cd30c824dac28bf9e 100644 (file)
@@ -2,47 +2,41 @@
 <html>
 <head>
 <script src="../../js/resources/js-test-pre.js"></script>
-<script src="resources/create-dom.js"></script>
+<script src="resources/shadow-dom.js"></script>
 </head>
 <body>
-<p id="description"></p>
-<div id="console"></div>
 <script>
-description("Tests to ensure that internals.getElementByIdInTreeScope can get an element in TreeScope by its id. Can only run within DRT");
-
-function getElementInShadow(path)
-{
-    var ids = path.split('/');
-    var element = document.getElementById(ids[0]);
-    for (var i = 1; element != null && i < ids.length; ++i) {
-        var shadowRoot = internals.shadowRoot(element);
-        element = internals.getElementByIdInShadowRoot(shadowRoot, ids[i]);
-    }
-    return element;
-}
+description("Tests to ensure that internals.getElementByIdInShadowRoot can get an element in ShadowRoot by its id. Can only run within DRT");
 
 function prepareDomTree(parent)
 {
     parent.appendChild(
-        createShadow('div', {'id': 'divA'},
-                     createDom('input', {'id': 'inputB'}),
-                     createShadow('div', {'id': 'divC'},
-                                  createDom('input', {'id': 'inputD'}))));
+        createDOM('div', {'id': 'divA'},
+                  createShadowRoot(
+                      createDOM('input', {'id': 'inputB'}),
+                      createDOM('div', {'id': 'divC'},
+                                createShadowRoot(
+                                    createDOM('input', {'id': 'inputD'})),
+                                createShadowRoot(
+                                    createDOM('input', {'id': 'inputE'})),
+                                createShadowRoot(
+                                    createDOM('input', {'id': 'inputF'}))))));
 }
 
 function test()
 {
     if (window.layoutTestController)
         layoutTestController.dumpAsText();
+
     prepareDomTree(document.body);
-    shouldBeEqualToString("getElementInShadow('divA/inputB').id", 'inputB');
-    shouldBeEqualToString("getElementInShadow('divA/divC').id", 'divC');
-    shouldBeEqualToString("getElementInShadow('divA/divC/inputD').id", 'inputD');
+    shouldBeEqualToString("getNodeInShadowTreeStack('divA/inputB').id", 'inputB');
+    shouldBeEqualToString("getNodeInShadowTreeStack('divA/divC').id", 'divC');
+    shouldBeEqualToString("getNodeInShadowTreeStack('divA/divC/inputD').id", 'inputD');
+    shouldBeEqualToString("getNodeInShadowTreeStack('divA/divC//inputE').id", 'inputE');
+    shouldBeEqualToString("getNodeInShadowTreeStack('divA/divC///inputF').id", 'inputF');
 }
 
 test();
-
-var successfullyParsed = true;
 </script>
 <script src="../../js/resources/js-test-post.js"></script>
 </body>