diff options
Diffstat (limited to 'LayoutTests/fast/dom/getElementsByClassName')
41 files changed, 381 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/getElementsByClassName/001-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/001-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/001-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/001.html b/LayoutTests/fast/dom/getElementsByClassName/001.html new file mode 100644 index 0000000..930aae5 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/001.html @@ -0,0 +1,11 @@ +<!doctype html> +<html class="a"> + <head> + <title>document.getElementsByClassName(): simple</title> + <script src="resources/common.js"></script> + </head> + <body class="a"> + <p id="r">FAIL (script did not run)</p> + <script> t(document.getElementsByClassName("\ta\n"), [document.documentElement, document.body]) </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/002-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/002-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/002-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/002.html b/LayoutTests/fast/dom/getElementsByClassName/002.html new file mode 100644 index 0000000..d91b0ac --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/002.html @@ -0,0 +1,13 @@ +<!doctype html> +<html class="a +b"> + <head> + <title>document.getElementsByClassName(): also simple</title> + <script src="resources/common.js"></script> + </head> + <body class="a +"> + <p id="r">FAIL (script did not run)</p> + <script> t(document.getElementsByClassName("a\n"), [document.documentElement, document.body]) </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/003-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/003-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/003-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/003.html b/LayoutTests/fast/dom/getElementsByClassName/003.html new file mode 100644 index 0000000..661dbba --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/003.html @@ -0,0 +1,15 @@ +<!doctype html> +<html class="a"> + <head> + <title>document.getElementsByClassName(): changing classes</title> + <script src="resources/common.js"></script> + </head> + <body class="a"> + <p id="r">FAIL (script did not run)</p> + <script> + var collection = document.getElementsByClassName("a") + document.body.className = "b" + t(collection, [document.documentElement]) + </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/004-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/004-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/004-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/004.html b/LayoutTests/fast/dom/getElementsByClassName/004.html new file mode 100644 index 0000000..a932dd1 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/004.html @@ -0,0 +1,15 @@ +<!doctype html> +<html class="a"> + <head> + <title>document.getElementsByClassName(): changing classes</title> + <script src="resources/common.js"></script> + </head> + <body class="a"> + <p id="r">FAIL (script did not run)</p> + <script> + var collection = document.getElementsByClassName("a") + document.body.className += "\tb" + t(collection, [document.documentElement, document.body]) + </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/005-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/005-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/005-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/005.html b/LayoutTests/fast/dom/getElementsByClassName/005.html new file mode 100644 index 0000000..5a609db --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/005.html @@ -0,0 +1,15 @@ +<!doctype html> +<html class="a"> + <head> + <title>document.getElementsByClassName(): changing classes</title> + <script src="resources/common.js"></script> + </head> + <body class="a"> + <p id="r">FAIL (script did not run)</p> + <script> + var collection = document.getElementsByClassName("a") + document.body.removeAttribute("class") + t(collection, [document.documentElement]) + </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/006-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/006-expected.txt new file mode 100644 index 0000000..9976b12 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/006-expected.txt @@ -0,0 +1,3 @@ +PASS + + diff --git a/LayoutTests/fast/dom/getElementsByClassName/006.html b/LayoutTests/fast/dom/getElementsByClassName/006.html new file mode 100644 index 0000000..89be60b --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/006.html @@ -0,0 +1,17 @@ +<!doctype html> +<html> + <head> + <title>document.getElementsByClassName(): adding element with class</title> + <script src="resources/common.js"></script> + </head> + <body class="a"> + <p id="r">FAIL (script did not run)</p> + <script> + var collection = document.getElementsByClassName("a"), + ele = document.createElement("foo"); + ele.setAttribute("class", "a"); + document.body.appendChild(ele) + t(collection, [document.body, ele]) + </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/007-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/007-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/007-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/007.html b/LayoutTests/fast/dom/getElementsByClassName/007.html new file mode 100644 index 0000000..bb013df --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/007.html @@ -0,0 +1,11 @@ +<!doctype html> +<html> + <head> + <title>document.getElementsByClassName(): multiple classes</title> + <script src="resources/common.js"></script> + </head> + <body class="a b"> + <p id="r">FAIL (script did not run)</p> + <script> t(document.getElementsByClassName("b\t\f\n\na\rb"), [document.body]) </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/008-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/008-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/008-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/008.html b/LayoutTests/fast/dom/getElementsByClassName/008.html new file mode 100644 index 0000000..b60129d --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/008.html @@ -0,0 +1,11 @@ +<!doctype html> +<html> + <head> + <title>document.getElementsByClassName(): multiple classes</title> + <script src="resources/common.js"></script> + </head> + <body class="a"> + <p id="r">FAIL (script did not run)</p> + <script> t(document.getElementsByClassName("a\fa"), [document.body]) </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/009-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/009-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/009-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/009.html b/LayoutTests/fast/dom/getElementsByClassName/009.html new file mode 100644 index 0000000..ce52987 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/009.html @@ -0,0 +1,11 @@ +<!doctype html> +<html class="a A"> + <head> + <title>document.getElementsByClassName(): case sensitive</title> + <script src="resources/common.js"></script> + </head> + <body class="a a"> + <p id="r">FAIL (script did not run)</p> + <script> t(document.getElementsByClassName("A a"), [document.documentElement]) </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/010-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/010-expected.txt new file mode 100644 index 0000000..9976b12 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/010-expected.txt @@ -0,0 +1,3 @@ +PASS + + diff --git a/LayoutTests/fast/dom/getElementsByClassName/010.xml b/LayoutTests/fast/dom/getElementsByClassName/010.xml new file mode 100644 index 0000000..44f8474 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/010.xml @@ -0,0 +1,12 @@ +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:g="http://www.w3.org/2000/svg"> + <head> + <title>document.getElementsByClassName(): compound</title> + <script src="resources/common.js"></script> + </head> + <body> + <p id="r">FAIL (script did not run)</p> + <x class="a"/> + <g:x class="a"/> + <script> t(document.getElementsByClassName("a"), document.getElementsByTagName("x")) </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/011-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/011-expected.txt new file mode 100644 index 0000000..9976b12 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/011-expected.txt @@ -0,0 +1,3 @@ +PASS + + diff --git a/LayoutTests/fast/dom/getElementsByClassName/011.xml b/LayoutTests/fast/dom/getElementsByClassName/011.xml new file mode 100644 index 0000000..6790b5a --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/011.xml @@ -0,0 +1,19 @@ +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:g="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:t="http://tc.labs.opera.com/#test"> + <head> + <title>document.getElementsByClassName(): "tricky" compound</title> + <script src="resources/common.js"></script> + </head> + <body> + <p id="r">FAIL (script did not run)</p> + <x class="a"/> + <g:x class="a"/> + <x t:class="a" h:class="a" g:class="a"/> + <g:x t:class="a" h:class="a" g:class="a"/> + <t:x class="a" t:class="a" h:class="a" g:class="a"/> + <script> + var collection = document.getElementsByClassName("a"), + test = document.getElementsByTagName("x") + t(collection, [test[0], test[1]]) + </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/012-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/012-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/012-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/012.html b/LayoutTests/fast/dom/getElementsByClassName/012.html new file mode 100644 index 0000000..ed93344 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/012.html @@ -0,0 +1,11 @@ +<!doctype html> +<html class="a"> + <head> + <title>element.getElementsByClassName(): simple</title> + <script src="resources/common.js"></script> + </head> + <body class="a"> + <p id="r">FAIL (script did not run)</p> + <script> t(document.body.getElementsByClassName("a"), []) </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/013-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/013-expected.txt new file mode 100644 index 0000000..9976b12 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/013-expected.txt @@ -0,0 +1,3 @@ +PASS + + diff --git a/LayoutTests/fast/dom/getElementsByClassName/013.html b/LayoutTests/fast/dom/getElementsByClassName/013.html new file mode 100644 index 0000000..7c8c232 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/013.html @@ -0,0 +1,17 @@ +<!doctype html> +<html class="a"> + <head> + <title>element.getElementsByClassName(): adding an element</title> + <script src="resources/common.js"></script> + </head> + <body class="a"> + <p id="r">FAIL (script did not run)</p> + <script> + var collection = document.body.getElementsByClassName("a"), + ele = document.createElement("x-y-z") + ele.className = "a" + document.body.appendChild(ele) + t(collection, [ele]) + </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/014-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/014-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/014-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/014.html b/LayoutTests/fast/dom/getElementsByClassName/014.html new file mode 100644 index 0000000..29dff66 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/014.html @@ -0,0 +1,14 @@ +<html class="a A"> + <head> + <title>document.getElementsByClassName(): case sensitive (quirks mode)</title> + <script src="resources/common.js"></script> + </head> + <body class="a a"> + <p id="r">FAIL (script did not run)</p> + <script> + // We differ from Opera's implementation here. We are case-insensitive in quirks mode. + // t(document.getElementsByClassName("A a"), [document.documentElement]) + t(document.getElementsByClassName("A a"), [document.documentElement, document.body]) + </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/015-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/015-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/015-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/015.html b/LayoutTests/fast/dom/getElementsByClassName/015.html new file mode 100644 index 0000000..567b990 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/015.html @@ -0,0 +1,14 @@ +<html class="a"> + <head> + <title>document.getElementsByClassName(): live updating</title> + <script src="resources/common.js"></script> + </head> + <body class="a"> + <p id="r">FAIL (script did not run)</p> + <script> + var elms = document.getElementsByClassName("a"); + elms[1].className = ""; + t(elms, [document.documentElement]); + </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/array/001-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/array/001-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/array/001-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/array/001.html b/LayoutTests/fast/dom/getElementsByClassName/array/001.html new file mode 100644 index 0000000..d002002 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/array/001.html @@ -0,0 +1,13 @@ +<!doctype html> +<html class="a +b"> + <head> + <title>document.getElementsByClassName(array): "a\n"</title> + <script src="../resources/common.js"></script> + </head> + <body class="a +"> + <p id="r">FAIL (script did not run)</p> + <script> t(document.getElementsByClassName(["a\n"]), [document.documentElement, document.body]) </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/array/002-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/array/002-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/array/002-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/array/002.html b/LayoutTests/fast/dom/getElementsByClassName/array/002.html new file mode 100644 index 0000000..2148e5e --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/array/002.html @@ -0,0 +1,12 @@ +<!doctype html> +<html class="a +b"> + <head> + <title>document.getElementsByClassName(array): "b","a"</title> + <script src="../resources/common.js"></script> + </head> + <body class="b,a"> + <p id="r">FAIL (script did not run)</p> + <script> t(document.getElementsByClassName(["b", "a"]), [document.body]) </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/array/003-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/array/003-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/array/003-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/array/003.html b/LayoutTests/fast/dom/getElementsByClassName/array/003.html new file mode 100644 index 0000000..e110dc9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/array/003.html @@ -0,0 +1,11 @@ +<!doctype html> +<html> + <head> + <title>document.getElementsByClassName(array): "b a"</title> + <script src="../resources/common.js"></script> + </head> + <body class="a b"> + <p id="r">FAIL (script did not run)</p> + <script> t(document.getElementsByClassName(["b a"]), [document.body]) </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/array/004-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/array/004-expected.txt new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/array/004-expected.txt @@ -0,0 +1 @@ +PASS diff --git a/LayoutTests/fast/dom/getElementsByClassName/array/004.html b/LayoutTests/fast/dom/getElementsByClassName/array/004.html new file mode 100644 index 0000000..3740509 --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/array/004.html @@ -0,0 +1,11 @@ +<!doctype html> +<html class="a,b"> + <head> + <title>element.getElementsByClassName(array): "a", "b"</title> + <script src="../resources/common.js"></script> + </head> + <body class="a,b x"> + <p id="r" class="a,bx">FAIL (script did not run)</p> + <script class="xa,b"> t(document.documentElement.getElementsByClassName(["\fa","b\n"]), [document.body]) </script> + </body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt b/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt new file mode 100644 index 0000000..373ffbc --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList-expected.txt @@ -0,0 +1,26 @@ +Line 1 +Line 2 +Line 3 + +line 4 +line 5 + +[object HTMLDivElement], [object HTMLDivElement], [object HTMLDivElement], length: 3 +[object HTMLDivElement], [object HTMLDivElement], [object HTMLDivElement], [object HTMLParagraphElement], length: 4 +[object HTMLDivElement], [object HTMLDivElement], length: 2 +[object HTMLDivElement], [object HTMLDivElement], length: 2 +length: 0 +length: 0 +length: 0 +length: 0 +length: 0 +[object HTMLDivElement], length: 1 +[object HTMLDivElement], [object HTMLParagraphElement], length: 2 +[object HTMLDivElement], length: 1 +[object HTMLDivElement], length: 1 +length: 0 +length: 0 +length: 0 +length: 0 +length: 0 + diff --git a/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html b/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html new file mode 100644 index 0000000..86bd42e --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/dumpNodeList.html @@ -0,0 +1,54 @@ +<html> +<body> +<div class="one">Line 1<div class="two">Line 2</div><p>Line <i>3</i></p></div> +<div id="test" class="one two"><div class="one two">line 4</div><p class="two">line 5</p></div> +<p><ol id="console"></ol></p> +<script type="text/javascript"> + if (window.layoutTestController) + layoutTestController.dumpAsText(); + + function log(message) + { + var item = document.createElement("li"); + item.appendChild(document.createTextNode(message)); + document.getElementById("console").appendChild(item); + } + + NodeList.prototype.dump = function() + { + var result = ""; + var i = 0; + for (; i < this.length; i++) + result += this[i] + ", "; + result += "length: " + i; + return result; + } + + try { + var elm = document.getElementById("test"); + + log(document.getElementsByClassName("one").dump()); + log(document.getElementsByClassName("two").dump()); + log(document.getElementsByClassName("one two").dump()); + log(document.getElementsByClassName("one\t\t\n \ftwo").dump()); + log(document.getElementsByClassName("").dump()); + log(document.getElementsByClassName("onetwo").dump()); + log(document.getElementsByClassName().dump()); + log(document.getElementsByClassName(null).dump()); + log(document.getElementsByClassName(undefined).dump()); + + log(elm.getElementsByClassName("one").dump()); + log(elm.getElementsByClassName("two").dump()); + log(elm.getElementsByClassName("one two").dump()); + log(elm.getElementsByClassName("one\t\t\n \ftwo").dump()); + log(elm.getElementsByClassName("").dump()); + log(elm.getElementsByClassName("onetwo").dump()); + log(elm.getElementsByClassName().dump()); + log(elm.getElementsByClassName(null).dump()); + log(elm.getElementsByClassName(undefined).dump()); + } catch (ex) { + log("Exception: " + ex.description); + } +</script> +</body> +</html> diff --git a/LayoutTests/fast/dom/getElementsByClassName/resources/common.js b/LayoutTests/fast/dom/getElementsByClassName/resources/common.js new file mode 100644 index 0000000..0ea011d --- /dev/null +++ b/LayoutTests/fast/dom/getElementsByClassName/resources/common.js @@ -0,0 +1,21 @@ +// runs a test and writes a log +function t(collection, elements) { + if (window.layoutTestController) + layoutTestController.dumpAsText(); + + var log = "", + r = document.getElementById("r"), + pass = true + if(collection.length != elements.length) { + pass = false + log += "Got " + collection.length + " elements, expected " + elements.length + ". " + } + for(var i = 0, max = collection.length > elements.length ? elements.length : collection.length; i < max; i++) { + if(collection[i] != elements[i]) { + pass = false + log += "Got element `" + collection[i].tagName + "` (" + collection[i].namespaceURI + ")" + log += ", expected element `" + elements[i].tagName + "` (" + elements[i].namespaceURI + "). " + } + } + r.textContent = pass ? "PASS" : "FAIL (" + log + ")" +} |