diff options
Diffstat (limited to 'testing/web-platform/tests/selectors')
8 files changed, 0 insertions, 395 deletions
diff --git a/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/cssom.html b/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/cssom.html deleted file mode 100644 index af5de10eb..000000000 --- a/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/cssom.html +++ /dev/null @@ -1,58 +0,0 @@ -<!doctype html> -<title>Selectors: CSSOM of case-sensitivity attribute selector</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<div id=log></div> -<script> -function new_sheet(use_media) { - var style = document.getElementsByTagName('style')[0]; - if (style) - style.parentNode.removeChild(style); - style = document.createElement('style'); - document.head.appendChild(style); - if (use_media) { - style.textContent = '@media all {}'; - return style.sheet.cssRules[0]; - } - return style.sheet; -} - -var tests = [ - // test input, expected serialization - ['[foo="bar"] /* sanity check */', '[foo="bar"]'], - ['[foo="bar" i]', '[foo="bar" i]'], - ['[foo="bar" /**/ i]', '[foo="bar" i]'], - ['[foo="bar"/**/i]', '[foo="bar" i]'], -] - -tests.forEach(function(arr) { - var input = arr[0]; - var expected = arr[1]; - ["", " in @media"].forEach(function(use_media) { - test(function() { - var sheet = new_sheet(use_media); - sheet.insertRule(input + ' {}', 0); - assert_equals(sheet.cssRules.length, 1); - }, input + ' insertRule' + use_media); - - test(function() { - var sheet = new_sheet(use_media); - sheet.insertRule(input + ' {}', 0); - assert_equals(sheet.cssRules[0].cssText.substr(0, expected.length), expected); - }, input + ' getting CSSRule#cssText' + use_media); - - test(function() { - var sheet = new_sheet(use_media); - sheet.insertRule(input + ' {}', 0); - assert_equals(sheet.cssRules[0].selectorText, expected); - }, input + ' getting CSSStyleRule#selectorText' + use_media); - - test(function() { - var sheet = new_sheet(use_media); - sheet.insertRule('foobar {}', 0); - sheet.cssRules[0].selectorText = input; - assert_equals(sheet.cssRules[0].selectorText, expected); - }, input + ' setting CSSStyleRule#selectorText' + use_media); - }); -}); -</script> diff --git a/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/resources/semantics-quirks.html b/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/resources/semantics-quirks.html deleted file mode 100644 index b6c3dfe4e..000000000 --- a/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/resources/semantics-quirks.html +++ /dev/null @@ -1,4 +0,0 @@ -<style></style> -<script> -var mode = "quirks mode"; -</script> diff --git a/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/resources/semantics-xml.xhtml b/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/resources/semantics-xml.xhtml deleted file mode 100644 index f4d40fb85..000000000 --- a/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/resources/semantics-xml.xhtml +++ /dev/null @@ -1,10 +0,0 @@ -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<style></style> -</head> -<body> -<script> -var mode = "XML"; -</script> -</body> -</html> diff --git a/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/resources/syntax-quirks.html b/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/resources/syntax-quirks.html deleted file mode 100644 index 4606419b3..000000000 --- a/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/resources/syntax-quirks.html +++ /dev/null @@ -1,5 +0,0 @@ -<style></style> -<div id=test foo="BAR"></div> -<script> -var mode = "quirks mode"; -</script> diff --git a/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/resources/syntax-xml.xhtml b/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/resources/syntax-xml.xhtml deleted file mode 100644 index 19491c94c..000000000 --- a/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/resources/syntax-xml.xhtml +++ /dev/null @@ -1,11 +0,0 @@ -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<style></style> -</head> -<body> -<div id="test" foo="BAR"/> -<script> -var mode = "XML"; -</script> -</body> -</html> diff --git a/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/semantics.html b/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/semantics.html deleted file mode 100644 index c455e2668..000000000 --- a/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/semantics.html +++ /dev/null @@ -1,146 +0,0 @@ -<!doctype html> -<title>Selectors: semantics of case-sensitivity attribute selector</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<style></style> -<div id=log></div> -<iframe id="quirks" src="resources/semantics-quirks.html"></iframe> -<iframe id="xml" src="resources/semantics-xml.xhtml"></iframe> -<script> -setup({explicit_done:true}); -var match = [ - // [selector, attrs...] (each attr is [ns, name, value]) - ["[foo='BAR'] /* sanity check (match) */", ["", "foo", "BAR"]], - ["[foo='bar' i]", ["", "foo", "BAR"]], - ["[foo='' i]", ["", "foo", ""]], - ["[foo='a\u0308' i] /* COMBINING in both */", ["", "foo", "A\u0308"]], - ["[foo='A\u0308' i] /* COMBINING in both */", ["", "foo", "a\u0308"]], - ["[*|foo='bar' i]", ["", "foo", "x"], ["a", "foo", "x"], ["b", "foo", "BAR"], ["c", "foo", "x"]], - ["[*|foo='bar' i]", ["", "foo", "BAR"], ["a", "foo", "x"], ["b", "foo", "x"], ["c", "foo", "x"]], - ["[align='left' i]", ["", "align", "LEFT"]], - ["[align='LEFT' i]", ["", "align", "left"]], - ["[class~='a' i]", ["", "class", "X A B"]], - ["[class~='A' i]", ["", "class", "x a b"]], - ["[id^='a' i]", ["", "id", "AB"]], - ["[id$='A' i]", ["", "id", "xa"]], - ["[lang|='a' i]", ["", "lang", "A-B"]], - ["[lang*='A' i]", ["", "lang", "xab"]], - ["[*|lang='a' i]", ["http://www.w3.org/XML/1998/namespace", "lang", "A"]], - ["[*|lang='A' i]", ["http://www.w3.org/XML/1998/namespace", "lang", "a"]], - ["@namespace x 'http://www.w3.org/XML/1998/namespace'; [x|lang='A' i]", ["http://www.w3.org/XML/1998/namespace", "lang", "a"]], - ["[foo='bar' i][foo='bar' i]", ["", "foo", "BAR"]], - ["[foo='BAR'][foo='bar' i]", ["", "foo", "BAR"]], - ["[foo='bar' i][foo='BAR']", ["", "foo", "BAR"]], -]; -var nomatch = [ - ["[missingattr] /* sanity check (no match) */", ["", "foo", "BAR"]], - ["[foo='' i]", ["", "foo", "BAR"]], - ["[foo='\u0000' i] /* \\0 in selector */", ["", "foo", ""]], - ["[foo='' i] /* \\0 in attribute */", ["", "foo", "\u0000"]], - ["[foo='\u00E4' i]", ["", "foo", "\u00C4"]], - ["[foo='\u00C4' i]", ["", "foo", "\u00E4"]], - ["[foo='a\u0308' i] /* COMBINING in selector */", ["", "foo", "\u00C4"]], - ["[foo~='a\u0308' i] /* COMBINING in selector */", ["", "foo", "\u00E4"]], - ["[foo^='A\u0308' i] /* COMBINING in selector */", ["", "foo", "\u00C4"]], - ["[foo$='A\u0308' i] /* COMBINING in selector */", ["", "foo", "\u00E4"]], - ["[foo*='\u00E4' i] /* COMBINING in attribute */", ["", "foo", "a\u0308"]], - ["[foo|='\u00E4' i] /* COMBINING in attribute */", ["", "foo", "A\u0308"]], - ["[foo='\u00C4' i] /* COMBINING in attribute */", ["", "foo", "a\u0308"]], - ["[foo='\u00C4' i] /* COMBINING in attribute */", ["", "foo", "A\u0308"]], - ["[foo='a\u0308' i] /* COMBINING in selector */", ["", "foo", "a"]], - ["[foo='a\u0308' i] /* COMBINING in selector */", ["", "foo", "A"]], - ["[foo='A\u0308' i] /* COMBINING in selector */", ["", "foo", "a"]], - ["[foo='A\u0308' i] /* COMBINING in selector */", ["", "foo", "A"]], - ["[foo='a' i] /* COMBINING in attribute */", ["", "foo", "a\u0308"]], - ["[foo='A' i] /* COMBINING in attribute */", ["", "foo", "a\u0308"]], - ["[foo='a' i] /* COMBINING in attribute */", ["", "foo", "A\u0308"]], - ["[foo='A' i] /* COMBINING in attribute */", ["", "foo", "A\u0308"]], - ["[foo='i' i]", ["", "foo", "\u0130"]], - ["[foo='i' i]", ["", "foo", "\u0131"]], - ["[foo='I' i]", ["", "foo", "\u0130"]], - ["[foo='I' i]", ["", "foo", "\u0131"]], - ["[foo='\u0130' i]", ["", "foo", "i"]], - ["[foo='\u0131' i]", ["", "foo", "i"]], - ["[foo='\u0130' i]", ["", "foo", "I"]], - ["[foo='\u0131' i]", ["", "foo", "I"]], - ["[foo='bar' i]", ["", "foo", "x"], ["a", "foo", "BAR"]], - ["[|foo='bar' i]", ["", "foo", "x"], ["a", "foo", "BAR"]], - ["[foo='bar' i]", ["", "FOO", "bar"]], - ["[foo='\t' i] /* tab in selector */", ["", "foo", " "]], - ["[foo=' ' i] /* tab in attribute */", ["", "foo", "\t"]], - ["@namespace x 'a'; [x|foo='' i]", ["A", "foo", ""]], - ["@namespace x 'A'; [x|foo='' i]", ["a", "foo", ""]], - ["[foo='bar' i][foo='bar']", ["", "foo", "BAR"]], - ["[foo='bar' i]", ["", "baz", "BAR"]], -]; -var mode = "standards mode"; -function format_attrs(attrs) { - var rv = []; - attrs.forEach(function(attr) { - var str = ""; - var ns = attr[0]; - var name = attr[1]; - var value = attr[2]; - if (ns) - str += "{" + ns + "}"; - str += name + "=\"" + value + "\""; - rv.push(str); - }); - return rv.join(" "); -} -onload = function() { - var quirks = document.getElementById('quirks').contentWindow; - var xml = document.getElementById('xml').contentWindow; - [window, quirks, xml].forEach(function(global) { - var style = global.document.getElementsByTagName('style')[0]; - var elm; - function clean_slate() { - style.textContent = ''; - if (elm) - elm.parentNode.removeChild(elm); - elm = global.document.createElement('div'); - global.document.body.appendChild(elm); - } - function set_attrs(attrs) { - attrs.forEach(function(attr) { - elm.setAttributeNS(attr[0], attr[1], attr[2]); - }); - } - match.forEach(function(arr) { - var s = arr[0]; - var attrs = arr.slice(1); - var ns_decl = s.substr(0, "@namespace".length) == "@namespace"; - test(function() { - clean_slate(); - set_attrs(attrs); - style.textContent = s + ' { visibility:hidden }'; - assert_equals(style.sheet.cssRules.length, (ns_decl ? 2 : 1), 'rule didn\'t parse into CSSOM'); - assert_equals(global.getComputedStyle(elm).visibility, 'hidden', 'selector didn\'t match'); - }, s + ' <div ' + format_attrs(attrs) + '> in ' + global.mode); - if (!ns_decl) { - test(function() { - assert_equals(global.document.querySelector(s), elm, 'selector didn\'t match'); - }, s + ' <div ' + format_attrs(attrs) + '> with querySelector in ' + global.mode); - } - }); - nomatch.forEach(function(arr) { - var s = arr[0]; - var attrs = arr.slice(1); - var ns_decl = s.substr(0, "@namespace".length) == "@namespace"; - test(function() { - clean_slate(); - set_attrs(attrs); - style.textContent = s + ' { visibility:hidden }'; - assert_equals(style.sheet.cssRules.length, (ns_decl ? 2 : 1), 'rule didn\'t parse into CSSOM'); - assert_equals(global.getComputedStyle(elm).visibility, 'visible', 'selector matched'); - }, s + ' <div ' + format_attrs(attrs) + '> in ' + global.mode); - if (!ns_decl) { - test(function() { - assert_equals(global.document.querySelector(s), null, 'selector matched'); - }, s + ' <div ' + format_attrs(attrs) + '> with querySelector in ' + global.mode); - } - }); - }); - done(); -}; -</script> diff --git a/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/syntax.html b/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/syntax.html deleted file mode 100644 index 9d895b8ef..000000000 --- a/testing/web-platform/tests/selectors/attribute-selectors/attribute-case/syntax.html +++ /dev/null @@ -1,119 +0,0 @@ -<!doctype html> -<title>Selectors: syntax of case-sensitivity attribute selector</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<style></style> -<div id=log></div> -<div id=test foo="BAR"></div> -<iframe id="quirks" src="resources/syntax-quirks.html"></iframe> -<iframe id="xml" src="resources/syntax-xml.xhtml"></iframe> -<script> -setup({explicit_done:true}); -var valid = [ - "[foo='BAR'] /* sanity check (valid) */", - "[foo='bar' i]", - "[foo='bar' I]", - "[foo=bar i]", - '[foo="bar" i]', - "[foo='bar'i]", - "[foo='bar'i ]", - "[foo='bar' i ]", - "[foo='bar' /**/ i]", - "[foo='bar' i /**/ ]", - "[foo='bar'/**/i/**/]", - "[foo=bar/**/i]", - "[foo='bar'\ti\t] /* \\t */", - "[foo='bar'\ni\n] /* \\n */", - "[foo='bar'\ri\r] /* \\r */", - "[foo='bar' \\i]", - "[foo='bar' \\69]", - "[foo~='bar' i]", - "[foo^='bar' i]", - "[foo$='bar' i]", - "[foo*='bar' i]", - "[foo|='bar' i]", - "[|foo='bar' i]", - "[*|foo='bar' i]", -]; -var invalid = [ - "[foo[ /* sanity check (invalid) */", - "[foo='bar' i i]", - "[foo i ='bar']", - "[foo= i 'bar']", - "[i foo='bar']", - "[foo='bar' i\u0000] /* \\0 */", - "[foo='bar' \u0130]", - "[foo='bar' \u0131]", - "[foo='bar' ii]", - "[foo='bar' ij]", - "[foo='bar' j]", - "[foo='bar' \\\\i]", - "[foo='bar' \\\\69]", - "[foo='bar' i()]", - "[foo='bar' i ()]", - "[foo='bar' () i]", - "[foo='bar' (i)]", - "[foo='bar' i []]", - "[foo='bar' [] i]", - "[foo='bar' [i]]", - "[foo='bar' i {}]", - "[foo='bar' {} i]", - "[foo='bar' {i}]", - "[foo='bar' 1i]", - "[foo='bar' 1]", - "[foo='bar' 'i']", - "[foo='bar' url(i)]", - "[foo='bar' ,i]", - "[foo='bar' i,]", - "[foo='bar']i", - "[foo='bar' |i]", - "[foo='bar' \\|i]", - "[foo='bar' *|i]", - "[foo='bar' \\*|i]", - "[foo='bar' *]", - "[foo='bar' \\*]", - "[foo i]", - "[foo/**/i]", -]; -var mode = "standards mode"; -onload = function() { - var quirks = document.getElementById('quirks').contentWindow; - var xml = document.getElementById('xml').contentWindow; - [window, quirks, xml].forEach(function(global) { - var style = global.document.getElementsByTagName('style')[0]; - var elm = global.document.getElementById('test'); - function clean_slate() { - style.textContent = ''; - assert_equals(style.sheet.cssRules.length, 0, 'CSSOM was not empty for empty stylesheet'); - assert_equals(global.getComputedStyle(elm).visibility, 'visible', 'computed style for empty stylesheet'); - } - valid.forEach(function(s) { - test(function() { - clean_slate(); - style.textContent = s + ' { visibility:hidden }'; - assert_equals(style.sheet.cssRules.length, 1, 'valid rule didn\'t parse into CSSOM'); - assert_equals(global.getComputedStyle(elm).visibility, 'hidden', 'valid selector didn\'t match'); - }, s + ' in ' + global.mode); - test(function() { - assert_equals(global.document.querySelector(s), elm, 'valid selector'); - }, s + ' with querySelector in ' + global.mode); - }); - invalid.forEach(function(s) { - test(function() { - clean_slate(); - style.textContent = s + ' { visibility:hidden }'; - assert_equals(style.sheet.cssRules.length, 0, 'invalid rule parsed into CSSOM'); - assert_equals(global.getComputedStyle(elm).visibility, 'visible', 'invalid selector matched'); - }, s + ' in ' + global.mode); - test(function() { - // Should be TypeError but this is not widely implemented yet - // and this isn't intended to be a querySelector API conformance test. - assert_throws(null, function() { - global.document.querySelector(s); - }, 'invalid selector'); - }, s + ' with querySelector in ' + global.mode); - }); - }); - done(); -}; -</script> diff --git a/testing/web-platform/tests/selectors/child-indexed-pseudo-class.html b/testing/web-platform/tests/selectors/child-indexed-pseudo-class.html deleted file mode 100644 index 1c58a5e87..000000000 --- a/testing/web-platform/tests/selectors/child-indexed-pseudo-class.html +++ /dev/null @@ -1,42 +0,0 @@ -<!doctype html> -<meta charset=utf-8> -<title>Matching of child-indexed pseudo-classes</title> -<link rel="author" title="Emilio Cobos Álvarez" href="mailto:ecoal95@gmail.com"> -<link rel="help" href="https://drafts.csswg.org/selectors-4/#child-index"> -<script src=/resources/testharness.js></script> -<script src=/resources/testharnessreport.js></script> -<script> -test(function() { - var check = function(element, selectors) { - for (var i = 0; i < selectors.length; ++i) { - var selector = selectors[i][0]; - var expected = selectors[i][1]; - assert_equals(expected, element.matches(selector), - "Expected " + element.tagName + " element to " + - (expected ? "match " : "not match ") + selector); - } - } - - var rootOfSubtreeSelectors = [ - [ ":first-child", true ], - [ ":last-child", true ], - [ ":first-of-type", true ], - [ ":last-of-type", true ], - [ ":nth-child(1)", true ], - [ ":nth-child(n)", true ], - [ ":nth-last-child(1)", true ], - [ ":nth-last-child(n)", true ], - [ ":nth-of-type(1)", true ], - [ ":nth-of-type(n)", true ], - [ ":nth-last-of-type(1)", true ], - [ ":nth-last-of-type(n)", true ], - [ ":nth-child(2)", false ], - [ ":nth-last-child(2)", false], - [ ":nth-of-type(2)", false ], - [ ":nth-last-of-type(2)", false], - ]; - - check(document.documentElement, rootOfSubtreeSelectors); - check(document.createElement('div'), rootOfSubtreeSelectors); -}, "child-indexed pseudo-classes should match without a parent") -</script> |