Index: LayoutTests/fast/html/imports/import-style-tree-order-dedup.html |
diff --git a/LayoutTests/fast/html/imports/import-style-tree-order-dedup.html b/LayoutTests/fast/html/imports/import-style-tree-order-dedup.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..63b531e2213dff9cf1444c684d03d009f3f4fe75 |
--- /dev/null |
+++ b/LayoutTests/fast/html/imports/import-style-tree-order-dedup.html |
@@ -0,0 +1,57 @@ |
+<!DOCTYPE html> |
+<body> |
+<script src="../../../resources/js-test.js"></script> |
+ |
+<link id="owningLink" rel="import" href="resources/style-target-blue.html"> |
+ |
+<style id="styleRed"> |
+.target1, .target2, .target3 { |
+ color: red; |
+} |
+</style> |
+ |
+<link id="sharedLink" rel="import" href="resources/style-target-blue.html"> |
+ |
+<style id="styleGreen"> |
+.target1 { |
+ color: green; |
+} |
+</style> |
+ |
+<div id="placeholder"></div> |
+ |
+<span id="target1" class="target1">Hello!</span> |
+<span id="target2" class="target2">Hello!</span> |
+<span id="target3" class="target3">Hello!</span> |
+ |
+<script> |
+function colorOf(element) |
+{ |
+ return window.getComputedStyle(element).color; |
+} |
+ |
+// owninigLink, styleRed, styleGreen |
+ |
+shouldBe("colorOf(target1)", "'rgb(0, 128, 0)'"); |
+shouldBe("colorOf(target2)", "'rgb(255, 0, 0)'"); |
+shouldBe("colorOf(target3)", "'rgb(255, 0, 0)'"); |
+ |
+var owningLinkElement = document.getElementById("owningLink"); |
+document.body.removeChild(owningLinkElement); |
+ |
+// styleRed, sharedLink, styleGreen |
+ |
+shouldBe("colorOf(target1)", "'rgb(0, 128, 0)'"); |
+shouldBe("colorOf(target2)", "'rgb(0, 0, 255)'"); |
+shouldBe("colorOf(target3)", "'rgb(255, 0, 0)'"); |
+ |
+document.body.insertBefore(owningLinkElement, placeholder); |
+ |
+// styleRed, sharedLink, styleGreen - owningLinkElement shouldn't affect others |
+ |
+shouldBe("colorOf(target1)", "'rgb(0, 128, 0)'"); |
+shouldBe("colorOf(target2)", "'rgb(0, 0, 255)'"); |
+shouldBe("colorOf(target3)", "'rgb(255, 0, 0)'"); |
+ |
+</script> |
+</body> |