diff options
Diffstat (limited to 'LayoutTests/fast/dom/StyleSheet')
11 files changed, 163 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/StyleSheet/css-medialist-item-expected.txt b/LayoutTests/fast/dom/StyleSheet/css-medialist-item-expected.txt new file mode 100644 index 0000000..1468f1b --- /dev/null +++ b/LayoutTests/fast/dom/StyleSheet/css-medialist-item-expected.txt @@ -0,0 +1,14 @@ +This tests indexing outside the range of the media list object. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS mediaList.length is 2 +PASS mediaList[0] is "screen" +PASS mediaList[1] is "print" +PASS mediaList[2] is null +PASS mediaList[-1] is undefined. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/StyleSheet/css-medialist-item.html b/LayoutTests/fast/dom/StyleSheet/css-medialist-item.html new file mode 100644 index 0000000..4d0c598 --- /dev/null +++ b/LayoutTests/fast/dom/StyleSheet/css-medialist-item.html @@ -0,0 +1,13 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/css-medialist-item.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/StyleSheet/get-stylesheet-byname-expected.txt b/LayoutTests/fast/dom/StyleSheet/get-stylesheet-byname-expected.txt new file mode 100644 index 0000000..31fb4c8 --- /dev/null +++ b/LayoutTests/fast/dom/StyleSheet/get-stylesheet-byname-expected.txt @@ -0,0 +1,10 @@ +This test verifies that a StyleSheet object will be returned instead of a HTMLStyleElement when calling document.styleSheets named property getter. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS document.styleSheets["test"] is styleElement.sheet +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/StyleSheet/get-stylesheet-byname.html b/LayoutTests/fast/dom/StyleSheet/get-stylesheet-byname.html new file mode 100644 index 0000000..ed23080 --- /dev/null +++ b/LayoutTests/fast/dom/StyleSheet/get-stylesheet-byname.html @@ -0,0 +1,13 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/get-stylesheet-byname.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime-2-expected.txt b/LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime-2-expected.txt new file mode 100644 index 0000000..5e51726 --- /dev/null +++ b/LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime-2-expected.txt @@ -0,0 +1,3 @@ +This test verifies that style sheet do not outlive their elements. Since you can get back to the element with the ownerNode attribute, it's important to keep the element alive. + +Test passed. diff --git a/LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime-2.html b/LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime-2.html new file mode 100644 index 0000000..ca6fa16 --- /dev/null +++ b/LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime-2.html @@ -0,0 +1,37 @@ +<html>
+<link rel="stylesheet" type="text/css" href="theme.css"/>
+
+<script>
+function runTest() {
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var linkElement = document.getElementsByTagName('link')[0];
+ var styleSheet = linkElement.sheet;
+
+ // delete link element
+ linkElement.parentNode.removeChild(linkElement);
+ linkElement = null;
+
+ if (window.gc) {
+ window.gc();
+ } else if (GCController) {
+ GCController.collect();
+ } else {
+ for (var i = 0; i < 10000; i++)
+ new Object();
+ }
+ styleSheet.ownerNode.cloneNode();
+
+ document.getElementById("result").innerHTML = "Test passed.";
+}
+</script>
+<body onload="runTest()">
+<p>
+This test verifies that style sheet do not outlive their elements.
+Since you can get back to the element with the ownerNode attribute,
+it's important to keep the element alive.
+</p>
+<p id="result">TEST HAS NOT RUN YET.</p>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime-expected.txt b/LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime-expected.txt new file mode 100644 index 0000000..d92e2d7 --- /dev/null +++ b/LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime-expected.txt @@ -0,0 +1,3 @@ +This test verifies that style sheets do not outlive their elements. Since you can get back to the element with the ownerNode attribute, it's important to keep the element alive. + +Test passed. diff --git a/LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime.html b/LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime.html new file mode 100644 index 0000000..54b1ac4 --- /dev/null +++ b/LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime.html @@ -0,0 +1,33 @@ +<head> +<script> +function runTest() +{ + if (window.layoutTestController) + layoutTestController.dumpAsText(); + + var styleElement = document.createElement('style'); + var styleSheet = styleElement.sheet; + styleElement = null; + + // create lots of objects to force a garbage collection + var i = 0; + var s; + while (i < 5000) { + i = i+1.11; + s = s + " "; + } + + styleSheet.ownerNode.cloneNode(); + + document.getElementById("result").innerHTML = "Test passed."; +} +</script> +</head> +<body onload="runTest()"> +<p> +This test verifies that style sheets do not outlive their elements. +Since you can get back to the element with the ownerNode attribute, +it's important to keep the element alive. +</p> +<p id="result">TEST HAS NOT RUN YET.</p> +</body> diff --git a/LayoutTests/fast/dom/StyleSheet/script-tests/TEMPLATE.html b/LayoutTests/fast/dom/StyleSheet/script-tests/TEMPLATE.html new file mode 100644 index 0000000..1951c43 --- /dev/null +++ b/LayoutTests/fast/dom/StyleSheet/script-tests/TEMPLATE.html @@ -0,0 +1,13 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="YOUR_JS_FILE_HERE"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/StyleSheet/script-tests/css-medialist-item.js b/LayoutTests/fast/dom/StyleSheet/script-tests/css-medialist-item.js new file mode 100644 index 0000000..22974e7 --- /dev/null +++ b/LayoutTests/fast/dom/StyleSheet/script-tests/css-medialist-item.js @@ -0,0 +1,16 @@ +description("This tests indexing outside the range of the media list object."); + +var styleElement = document.createElement('style'); +styleElement.setAttribute('media', 'screen, print'); +document.documentElement.appendChild(styleElement) +var mediaList = document.styleSheets[document.styleSheets.length - 1].media; + +shouldEvaluateTo('mediaList.length', 2); +shouldBeEqualToString('mediaList[0]', 'screen'); +shouldBeEqualToString('mediaList[1]', 'print'); +shouldBeNull('mediaList[2]'); +shouldBeUndefined('mediaList[-1]') + +document.documentElement.removeChild(styleElement); + +successfullyParsed = true; diff --git a/LayoutTests/fast/dom/StyleSheet/script-tests/get-stylesheet-byname.js b/LayoutTests/fast/dom/StyleSheet/script-tests/get-stylesheet-byname.js new file mode 100644 index 0000000..793ed65 --- /dev/null +++ b/LayoutTests/fast/dom/StyleSheet/script-tests/get-stylesheet-byname.js @@ -0,0 +1,8 @@ +description("This test verifies that a StyleSheet object will be returned instead of a HTMLStyleElement when calling document.styleSheets named property getter."); + +var styleElement = document.createElement("style"); +styleElement.setAttribute("id", "test"); +document.head.appendChild(styleElement); +shouldBe('document.styleSheets["test"]', 'styleElement.sheet'); + +var successfullyParsed = true; |