diff options
Diffstat (limited to 'dom/tests')
6 files changed, 0 insertions, 670 deletions
diff --git a/dom/tests/mochitest/webcomponents/mochitest.ini b/dom/tests/mochitest/webcomponents/mochitest.ini index f5d0f84ea..756e6f2ae 100644 --- a/dom/tests/mochitest/webcomponents/mochitest.ini +++ b/dom/tests/mochitest/webcomponents/mochitest.ini @@ -25,7 +25,6 @@ skip-if = true || stylo # disabled - See bug 1390396 and 1293844 skip-if = !debug # TestFunctions only applied in debug builds [test_nested_content_element.html] [test_dest_insertion_points.html] -[test_dest_insertion_points_shadow.html] [test_fallback_dest_insertion_points.html] [test_detached_style.html] [test_dynamic_content_element_matching.html] @@ -38,7 +37,6 @@ skip-if = true # disabled - See bug 1390396 [test_document_register_stack.html] skip-if = true # disabled - See bug 1390396 [test_document_shared_registry.html] -[test_event_dispatch.html] [test_event_retarget.html] [test_event_stopping.html] [test_template.html] @@ -46,11 +44,8 @@ skip-if = true # disabled - See bug 1390396 [test_template_custom_elements.html] [test_shadowroot.html] [test_shadowroot_inert_element.html] -[test_shadowroot_host.html] [test_shadowroot_style.html] -[test_shadowroot_style_multiple_shadow.html] [test_shadowroot_style_order.html] -[test_shadowroot_youngershadowroot.html] [test_style_fallback_content.html] [test_unresolved_pseudo_class.html] [test_link_prefetch.html] diff --git a/dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html b/dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html deleted file mode 100644 index 75286463e..000000000 --- a/dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html +++ /dev/null @@ -1,68 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=999999 ---> -<head> - <meta charset="utf-8"> - <title>Test for Bug 999999</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=999999">Mozilla Bug 999999</a> -<p id="display"></p> -<div id="content"> -<div id="shadowhost"></div> -</div> -<pre id="test"> -</pre> -<script type="application/javascript"> - -/** Test for Bug 999999 **/ -var host = document.getElementById("shadowhost"); - -// Test destination insertion points of node distributed to shadow element. -var olderShadowRoot = host.createShadowRoot(); -var youngerShadowRoot = host.createShadowRoot(); - -var shadowElem = document.createElement("shadow"); -youngerShadowRoot.appendChild(shadowElem); - -var span = document.createElement("span"); -olderShadowRoot.appendChild(span); - -is(span.getDestinationInsertionPoints().length, 1, "Child of ShadowRoot should be distributed to shadow insertion point."); -is(span.getDestinationInsertionPoints()[0], shadowElem, "Shadow element should be in destination insertion point list."); - -// Test destination insertion points of node removed from tree. -olderShadowRoot.removeChild(span); -is(span.getDestinationInsertionPoints().length, 0, "Node removed from tree should no longer be distributed."); - -// Test destination insertion points of fallback content being reprojected into a shadow element. -var content = document.createElement("content"); -var fallback = document.createElement("span"); - -content.appendChild(fallback); -olderShadowRoot.appendChild(content); - -is(fallback.getDestinationInsertionPoints().length, 2, "The fallback content should have 2 destination insertion points, the parent content and the shadow element to which it is reprojected."); -is(fallback.getDestinationInsertionPoints()[0], content, "First destination of the fallback content should be the parent content element."); -is(fallback.getDestinationInsertionPoints()[1], shadowElem, "Second destination of the fallback content should be the shadow element to which the element is reprojected."); - -// Test destination insertion points of fallback content being removed from tree. -content.removeChild(fallback); -is(fallback.getDestinationInsertionPoints().length, 0, "The content should no longer be distributed to any nodes because it is no longer fallback content."); - -// Test destination insertion points of distributed content after removing shadow insertion point. -var div = document.createElement("div"); -olderShadowRoot.appendChild(div); -is(div.getDestinationInsertionPoints().length, 1, "Children in older shadow root should be distributed to shadow insertion point."); -is(div.getDestinationInsertionPoints()[0], shadowElem, "Destination insertion point should include shadow element."); - -youngerShadowRoot.removeChild(shadowElem); -is(div.getDestinationInsertionPoints().length, 0, "Destination insertion points should be empty after removing shadow element."); - -</script> -</body> -</html> diff --git a/dom/tests/mochitest/webcomponents/test_event_dispatch.html b/dom/tests/mochitest/webcomponents/test_event_dispatch.html deleted file mode 100644 index c73bfb214..000000000 --- a/dom/tests/mochitest/webcomponents/test_event_dispatch.html +++ /dev/null @@ -1,458 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=887541 ---> -<head> - <title>Test for event model in web components</title> - <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=887541">Bug 887541</a> -<script> - -var els = SpecialPowers.Cc["@mozilla.org/eventlistenerservice;1"] - .getService(SpecialPowers.Ci.nsIEventListenerService); - -function eventListener(e) { - eventChain.push(this); -} - -function isEventChain(actual, expected, msg) { - is(actual.length, expected.length, msg); - for (var i = 0; i < expected.length; i++) { - is(actual[i], expected[i], msg + " at " + i); - } - - // Check to make sure the event chain matches what we get back from nsIEventListenerService.getEventTargetChainFor - if (0 < actual.length) { - var chain = els.getEventTargetChainFor(actual[0], true); // Events should be dispatched on actual[0]. - for (var i = 0; i < expected.length; i++) { - ok(SpecialPowers.compare(chain[i], expected[i]), msg + " at " + i + " for nsIEventListenerService"); - } - } -} - -/* - * Test 1: Test of event dispatch through a basic ShadowRoot with content a insertion point. - * - * <div elemOne> ------ <shadow-root shadowOne> - * | | - * <div elemTwo> <span elemThree> - * | - * <content elemFour> - */ - -var elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -var elemTwo = document.createElement("div"); -elemTwo.addEventListener("custom", eventListener); - -var elemThree = document.createElement("span"); -elemThree.addEventListener("custom", eventListener); - -var elemFour = document.createElement("content"); -elemFour.addEventListener("custom", eventListener); - -var shadowOne = elemOne.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -elemThree.appendChild(elemFour); -shadowOne.appendChild(elemThree); -elemOne.appendChild(elemTwo); - -var eventChain = []; -var customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemTwo.dispatchEvent(customEvent); -isEventChain(eventChain, [elemTwo, elemFour, elemThree, shadowOne, elemOne], "Event path for test 1 for event dispatched on elemTwo."); - -/* - * Test 2: Test of event dispatch through a nested ShadowRoots with content insertion points. - * - * <div elemFive> --- <shadow-root shadowTwo> - * | | - * <div elemOne> <div elemFour> ----- <shadow-root shadowOne> - * | | - * <content elemTwo> <p elemSix> - * | - * <content elemThree> - */ - -elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -elemTwo = document.createElement("content"); -elemTwo.addEventListener("custom", eventListener); - -elemThree = document.createElement("content"); -elemThree.addEventListener("custom", eventListener); - -var elemFour = document.createElement("div"); -elemFour.addEventListener("custom", eventListener); - -var elemFive = document.createElement("div"); -elemFive.addEventListener("custom", eventListener); - -var elemSix = document.createElement("p"); -elemSix.addEventListener("custom", eventListener); - -var shadowOne = elemFour.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -var shadowTwo = elemFive.createShadowRoot(); -shadowTwo.addEventListener("custom", eventListener); - -elemFive.appendChild(elemOne); -shadowTwo.appendChild(elemFour); -elemFour.appendChild(elemTwo); -shadowOne.appendChild(elemSix); -elemSix.appendChild(elemThree); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemOne.dispatchEvent(customEvent); -is(elemOne.getDestinationInsertionPoints().length, 2, "yes"); -isEventChain(eventChain, [elemOne, elemThree, elemSix, shadowOne, elemTwo, elemFour, shadowTwo, elemFive], "Event path for test 2 for event dispatched on elemOne."); - -/* - * Test 3: Test of event dispatch through nested ShadowRoot with content insertion points. - * - * <div elemOne> ------- <shadow-root shadowOne> - * | | - * <span elemTwo> <span elemThree> ------------ <shadow-root shadowTwo> - * | | - * <span elemFour> <content elemSix> - * | - * <content elemFive> - */ - -elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -elemTwo = document.createElement("span"); -elemTwo.addEventListener("custom", eventListener); - -elemThree = document.createElement("span"); -elemThree.addEventListener("custom", eventListener); - -elemFour = document.createElement("span"); -elemFour.addEventListener("custom", eventListener); - -elemFive = document.createElement("content"); -elemFive.addEventListener("custom", eventListener); - -elemSix = document.createElement("content"); -elemSix.addEventListener("custom", eventListener); - -shadowOne = elemOne.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -shadowTwo = elemThree.createShadowRoot(); -shadowTwo.addEventListener("custom", eventListener); - -elemOne.appendChild(elemTwo); -shadowOne.appendChild(elemThree); -elemThree.appendChild(elemFour); -elemFour.appendChild(elemFive); -shadowTwo.appendChild(elemSix); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemTwo.dispatchEvent(customEvent); -isEventChain(eventChain, [elemTwo, elemFive, elemFour, elemSix, shadowTwo, elemThree, shadowOne, elemOne], "Event path for test 3 for event dispatched on elemTwo."); - -/* - * Test 4: Test of event dispatch through host with multiple ShadowRoots with shadow insertion point. - * - * <div elemSeven> --- <shadow-root shadowTwo> (younger ShadowRoot) - * | | | - * <div elemOne> | <div elemSix> -------- <shadow-root shadowOne> - * | | | - * | <shadow elemFour> <content elemFive> - * | | - * | <content elemTwo> - * | - * --- <shadow-root shadowThree> (older ShadowRoot) - * | | - * | <content elemThree> - * | - * <div elemEight> - */ - -elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -elemTwo = document.createElement("content"); -elemTwo.addEventListener("custom", eventListener); - -elemThree = document.createElement("content"); -elemThree.addEventListener("custom", eventListener); - -elemFour = document.createElement("shadow"); -elemFour.addEventListener("custom", eventListener); - -elemFive = document.createElement("content"); -elemFive.addEventListener("custom", eventListener); - -elemSix = document.createElement("div"); -elemSix.addEventListener("custom", eventListener); - -var elemSeven = document.createElement("div"); -elemSeven.addEventListener("custom", eventListener); - -var elemEight = document.createElement("div"); -elemEight.addEventListener("custom", eventListener); - -var shadowThree = elemSeven.createShadowRoot(); -shadowThree.addEventListener("custom", eventListener); - -shadowTwo = elemSeven.createShadowRoot(); -shadowTwo.addEventListener("custom", eventListener); - -shadowOne = elemSix.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -elemSeven.appendChild(elemOne); -shadowTwo.appendChild(elemSix); -elemSix.appendChild(elemFour); -elemFour.appendChild(elemTwo); -shadowThree.appendChild(elemEight); -shadowThree.appendChild(elemThree); -shadowOne.appendChild(elemFive); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemOne.dispatchEvent(customEvent); -isEventChain(eventChain, [elemOne, elemFive, shadowOne, elemThree, shadowThree, elemTwo, elemFour, elemSix, shadowTwo, elemSeven], "Event path for test 4 for event dispatched on elemOne."); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemEight.dispatchEvent(customEvent); -isEventChain(eventChain, [elemEight, elemFive, shadowOne, elemSix, shadowTwo, elemSeven], "Event path for test 4 for event dispatched on elemEight."); - -/* - * Test 5: Test of event dispatch through nested shadowroot with insertion points that match specific tags. - * - * <div elemOne> --------- <shadow-root shadowOne> - * | | | - * | <p elemThree> <span elemFour> ------------------------ <shadow-root shadowTwo> - * | | | | - * <span elemTwo> | <content select="p" elemFive> <content elemSeven> - * | - * <content select="span" elemSix> - */ - -elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -elemTwo = document.createElement("span"); -elemTwo.addEventListener("custom", eventListener); - -elemThree = document.createElement("p"); -elemThree.addEventListener("custom", eventListener); - -elemFour = document.createElement("span"); -elemFour.addEventListener("custom", eventListener); - -elemFive = document.createElement("content"); -elemFive.select = "p"; -elemFive.addEventListener("custom", eventListener); - -elemSix = document.createElement("content"); -elemSix.select = "span"; -elemSix.addEventListener("custom", eventListener); - -elemSeven = document.createElement("content"); -elemSeven.addEventListener("custom", eventListener); - -shadowTwo = elemFour.createShadowRoot(); -shadowTwo.addEventListener("custom", eventListener); - -shadowOne = elemOne.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -elemOne.appendChild(elemTwo); -elemOne.appendChild(elemThree); -shadowOne.appendChild(elemFour); -elemFour.appendChild(elemSix); -elemFour.appendChild(elemFive); -shadowTwo.appendChild(elemSeven); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemTwo.dispatchEvent(customEvent); -isEventChain(eventChain, [elemTwo, elemSeven, shadowTwo, elemSix, elemFour, shadowOne, elemOne], "Event path for test 5 for event dispatched on elemTwo."); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemThree.dispatchEvent(customEvent); -isEventChain(eventChain, [elemThree, elemSeven, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 5 for event dispatched on elemThree."); - -/* - * Test 6: Test of event dispatch through nested shadowroot with insertion points that match specific tags. - * - * <div elemOne> --------- <shadow-root shadowOne>; - * | | | - * | <p elemThree> <span elemFour> ------ <shadow-root shadowTwo> - * | | | | - * <span elemTwo> <content elemFive> | <content select="p" elemSeven> - * | - * <content select="span" elemSix> - */ - -elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -elemTwo = document.createElement("span"); -elemTwo.addEventListener("custom", eventListener); - -elemThree = document.createElement("p"); -elemThree.addEventListener("custom", eventListener); - -elemFour = document.createElement("span"); -elemFour.addEventListener("custom", eventListener); - -elemFive = document.createElement("content"); -elemFive.addEventListener("custom", eventListener); - -elemSix = document.createElement("content"); -elemSix.select = "span"; -elemSix.addEventListener("custom", eventListener); - -elemSeven = document.createElement("content"); -elemSeven.select = "p"; -elemSeven.addEventListener("custom", eventListener); - -shadowTwo = elemFour.createShadowRoot(); -shadowTwo.addEventListener("custom", eventListener); - -shadowOne = elemOne.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -elemOne.appendChild(elemTwo); -elemOne.appendChild(elemThree); -shadowOne.appendChild(elemFour); -elemFour.appendChild(elemFive); -shadowTwo.appendChild(elemSix); -shadowTwo.appendChild(elemSeven); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemTwo.dispatchEvent(customEvent); -isEventChain(eventChain, [elemTwo, elemSix, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 6 for event dispatched on elemTwo."); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemThree.dispatchEvent(customEvent); -isEventChain(eventChain, [elemThree, elemSeven, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 6 for event dispatched on elemThree."); - -/* - * Test 7: Test of event dispatch through nested shadowroot with insertion points that match specific tags. - * - * <div elemOne> --------- <shadow-root shadowOne> - * | | | - * | <p elemThree> <span elemFour> ------ <shadow-root shadowTwo> - * | | | - * <span elemTwo> <content elemFive> <span elemEight> - * | | - * | <content select="p" elemSeven> - * | - * <content select="span" elemSix> - */ - -elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -elemTwo = document.createElement("span"); -elemTwo.addEventListener("custom", eventListener); - -elemThree = document.createElement("p"); -elemThree.addEventListener("custom", eventListener); - -elemFour = document.createElement("span"); -elemFour.addEventListener("custom", eventListener); - -elemFive = document.createElement("content"); -elemFive.addEventListener("custom", eventListener); - -elemSix = document.createElement("content"); -elemSix.select = "span"; -elemSix.addEventListener("custom", eventListener); - -elemSeven = document.createElement("content"); -elemSeven.select = "p"; -elemSeven.addEventListener("custom", eventListener); - -elemEight = document.createElement("span"); -elemEight.addEventListener("custom", eventListener); - -shadowTwo = elemFour.createShadowRoot(); -shadowTwo.addEventListener("custom", eventListener); - -shadowOne = elemOne.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -elemOne.appendChild(elemTwo); -elemOne.appendChild(elemThree); -shadowOne.appendChild(elemFour); -elemFour.appendChild(elemFive); -shadowTwo.appendChild(elemEight); -elemEight.appendChild(elemSix); -elemEight.appendChild(elemSeven); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemTwo.dispatchEvent(customEvent); -isEventChain(eventChain, [elemTwo, elemSix, elemEight, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 7 for event dispatched on elemTwo."); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemThree.dispatchEvent(customEvent); -isEventChain(eventChain, [elemThree, elemSeven, elemEight, shadowTwo, elemFive, elemFour, shadowOne, elemOne], "Event path for test 7 for event dispatched on elemThree."); - -/* - * Test 8: Test of event dispatch through host with multiple ShadowRoots with shadow insertion point. - * - * <div elemOne> --- <shadow-root shadowOne> (younger ShadowRoot) - * | | - * | <div elemFour> - * | | - * | <shadow elemTwo> - * | - * --- <shadow-root shadowTwo> (older ShadowRoot) - * | - * <div elemThree> - */ - -elemOne = document.createElement("div"); -elemOne.addEventListener("custom", eventListener); - -elemTwo = document.createElement("shadow"); -elemTwo.addEventListener("custom", eventListener); - -elemThree = document.createElement("div"); -elemThree.addEventListener("custom", eventListener); - -elemFour = document.createElement("div"); -elemFour.addEventListener("custom", eventListener); - -shadowTwo = elemOne.createShadowRoot(); -shadowTwo.addEventListener("custom", eventListener); - -shadowOne = elemOne.createShadowRoot(); -shadowOne.addEventListener("custom", eventListener); - -shadowOne.appendChild(elemFour); -elemFour.appendChild(elemTwo); -shadowTwo.appendChild(elemThree); - -eventChain = []; -customEvent = new CustomEvent("custom", { "bubbles" : true, "composed" : true }); -elemThree.dispatchEvent(customEvent); -isEventChain(eventChain, [elemThree, shadowTwo, elemTwo, elemFour, shadowOne, elemOne], "Event path for test 8 for event dispatched on elemThree."); - -</script> -</body> -</html> diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_host.html b/dom/tests/mochitest/webcomponents/test_shadowroot_host.html deleted file mode 100644 index f48d63e87..000000000 --- a/dom/tests/mochitest/webcomponents/test_shadowroot_host.html +++ /dev/null @@ -1,41 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=1083587 ---> -<head> - <meta charset="utf-8"> - <title>Test for Bug 1083587</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1083587">Mozilla Bug 1083587</a> -<p id="display"></p> -<div id="content" style="display: none"> -<div id="host"></div> -</div> -<pre id="test"> -</pre> -<script type="application/javascript"> - -/** Test for Bug 1083587 **/ -var hostInDoc = document.getElementById("host"); -var shadowOne = hostInDoc.createShadowRoot(); -is(shadowOne.host, hostInDoc); - -var shadowTwo = hostInDoc.createShadowRoot(); -is(shadowOne.host, hostInDoc); -is(shadowTwo.host, hostInDoc); - -var hostNotInDoc = document.createElement("div"); -var shadowThree = hostNotInDoc.createShadowRoot(); -is(shadowThree.host, hostNotInDoc); - -var shadowFour = hostNotInDoc.createShadowRoot(); -is(shadowThree.host, hostNotInDoc); -is(shadowFour.host, hostNotInDoc); - -</script> -</body> -</html> diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_style_multiple_shadow.html b/dom/tests/mochitest/webcomponents/test_shadowroot_style_multiple_shadow.html deleted file mode 100644 index 7a606bcd7..000000000 --- a/dom/tests/mochitest/webcomponents/test_shadowroot_style_multiple_shadow.html +++ /dev/null @@ -1,57 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=806506 ---> -<head> - <title>Test for ShadowRoot styles with multiple ShadowRoot on host.</title> - <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> -</head> -<body> -<div class="tall" id="bodydiv"></div> -<div id="container"></div> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a> -<script> -// Create ShadowRoot. -var container = document.getElementById("container"); -var elem = document.createElement("div"); -container.appendChild(elem); // Put ShadowRoot host in document. -var firstRoot = elem.createShadowRoot(); -var secondRoot = elem.createShadowRoot(); -var thirdRoot = elem.createShadowRoot(); - -// A style element that will be appended into the ShadowRoot. -var firstStyle = document.createElement("style"); -firstRoot.appendChild(firstStyle); -is(firstRoot.styleSheets.length, 1, "firstStyle should be the only style in firstRoot."); -is(firstRoot.styleSheets[0].ownerNode, firstStyle, "firstStyle should in the ShadowRoot styleSheets."); - -var secondStyle = document.createElement("style"); -secondRoot.appendChild(secondStyle); -is(secondRoot.styleSheets.length, 1, "secondStyle should be the only style in secondRoot."); -is(secondRoot.styleSheets[0].ownerNode, secondStyle, "secondStyle should in the ShadowRoot styleSheets."); - -var thirdStyle = document.createElement("style"); -thirdRoot.appendChild(thirdStyle); -is(thirdRoot.styleSheets.length, 1, "thirdStyle should be the only style in thirdRoot."); -is(thirdRoot.styleSheets[0].ownerNode, thirdStyle, "thirdStyle should in the ShadowRoot styleSheets."); - -// Check the stylesheet counts again to make sure that none of the style sheets leaked into the older ShadowRoots. -is(firstRoot.styleSheets.length, 1, "Adding a stylesheet to a younger ShadowRoot should not affect stylesheets in the older ShadowRoot."); -is(secondRoot.styleSheets.length, 1, "Adding a stylesheet to a younger ShadowRoot should not affect stylesheets in the older ShadowRoot."); - -// Remove styles and make sure they are removed from the correct ShadowRoot. -firstRoot.removeChild(firstStyle); -is(firstRoot.styleSheets.length, 0, "firstRoot should no longer have any styles."); - -thirdRoot.removeChild(thirdStyle); -is(thirdRoot.styleSheets.length, 0, "thirdRoot should no longer have any styles."); - -secondRoot.removeChild(secondStyle); -is(secondRoot.styleSheets.length, 0, "secondRoot should no longer have any styles."); - -</script> -</body> -</html> - diff --git a/dom/tests/mochitest/webcomponents/test_shadowroot_youngershadowroot.html b/dom/tests/mochitest/webcomponents/test_shadowroot_youngershadowroot.html deleted file mode 100644 index 17743321b..000000000 --- a/dom/tests/mochitest/webcomponents/test_shadowroot_youngershadowroot.html +++ /dev/null @@ -1,41 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=1083587 ---> -<head> - <meta charset="utf-8"> - <title>Test for Bug 1083587</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1083587">Mozilla Bug 1083587</a> -<p id="display"></p> -<div id="content" style="display: none"> -<div id="host"></div> -</div> -<pre id="test"> -</pre> -<script type="application/javascript"> - -/** Test for Bug 1083587 **/ -var hostInDoc = document.getElementById("host"); -var shadowOne = hostInDoc.createShadowRoot(); -is(shadowOne.olderShadowRoot, null); - -var shadowTwo = hostInDoc.createShadowRoot(); -is(shadowOne.olderShadowRoot, null); -is(shadowTwo.olderShadowRoot, shadowOne); - -var hostNotInDoc = document.createElement("div"); -var shadowThree = hostNotInDoc.createShadowRoot(); -is(shadowThree.olderShadowRoot, null); - -var shadowFour = hostNotInDoc.createShadowRoot(); -is(shadowThree.olderShadowRoot, null); -is(shadowFour.olderShadowRoot, shadowThree); - -</script> -</body> -</html> |