Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: pkg/third_party/html5lib/test/selectors/selectors.dart

Issue 268623002: [html5lib] implement querySelector/querySelectorAll (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /// Test for the Selectors API ported from
2 /// <https://github.com/w3c/web-platform-tests/tree/master/selectors-api>
3 library html5lib.test.selectors.selectors;
4
5 // Bit-mapped flags to indicate which tests the selector is suitable for
6 var TEST_QSA_BASELINE = 0x01; // querySelector() and querySelectorAll() base line tests
7 var TEST_QSA_ADDITIONAL = 0x02; // querySelector() and querySelectorAll() addi tional tests
8 var TEST_FIND_BASELINE = 0x04; // find() and findAll() baseline tests, may be unsuitable for querySelector[All]
9 var TEST_FIND_ADDITIONAL = 0x08; // find() and findAll() additional tests, may be unsuitable for querySelector[All]
10 var TEST_MATCH_BASELINE = 0x10; // matches() baseline tests
11 var TEST_MATCH_ADDITIONAL = 0x20; // matches() additional tests
12
13
14 /*
15 * All of these invalid selectors should result in a SyntaxError being thrown by the APIs.
16 *
17 * name: A descriptive name of the selector being tested
18 * selector: The selector to test
19 */
20 var invalidSelectors = [
21 {'name': "Empty String", 'selector': ""},
22 {'name': "Invalid character", 'selector': "["},
23 {'name': "Invalid character", 'selector': "]"},
24 {'name': "Invalid character", 'selector': "("},
25 {'name': "Invalid character", 'selector': ")"},
26 {'name': "Invalid character", 'selector': "{"},
27 {'name': "Invalid character", 'selector': "}"},
28 {'name': "Invalid character", 'selector': "<"},
29 {'name': "Invalid character", 'selector': ">"},
30 {'name': "Invalid ID", 'selector': "#"},
31 {'name': "Invalid group of selectors", 'selector': "div,"},
32 {'name': "Invalid class", 'selector': "."},
33 {'name': "Invalid class", 'selector': ".5cm"},
34 {'name': "Invalid class", 'selector': "..test"},
35 {'name': "Invalid class", 'selector': ".foo..quux"},
36 {'name': "Invalid class", 'selector': ".bar."},
37 {'name': "Invalid combinator", 'selector': "div & address, p"},
38 {'name': "Invalid combinator", 'selector': "div >> address, p"},
39 {'name': "Invalid combinator", 'selector': "div ++ address, p"},
40 {'name': "Invalid combinator", 'selector': "div ~~ address, p"},
41 {'name': "Invalid [att=value] selector", 'selector': "[*=test]"},
42 {'name': "Invalid [att=value] selector", 'selector': "[*|*=test]"},
43 {'name': "Invalid [att=value] selector", 'selector': "[class= space unquoted ] "},
44 {'name': "Unknown pseudo-class", 'selector': "div:example"},
45 {'name': "Unknown pseudo-class", 'selector': ":example"},
46 {'name': "Unknown pseudo-element", 'selector': "div::example"},
47 {'name': "Unknown pseudo-element", 'selector': "::example"},
48 {'name': "Invalid pseudo-element", 'selector': ":::before"},
49 {'name': "Undeclared namespace", 'selector': "ns|div"},
50 {'name': "Undeclared namespace", 'selector': ":not(ns|div)"},
51 {'name': "Invalid namespace", 'selector': "^|div"},
52 {'name': "Invalid namespace", 'selector': "\$|div"}
53 ];
54
55 /*
56 * All of these should be valid selectors, expected to match zero or more elemen ts in the document.
57 * None should throw any errors.
58 *
59 * name: A descriptive name of the selector being tested
60 * selector: The selector to test
61 * 'expect': A list of IDs of the elements expected to be matched. List must be given in tree order.
62 * 'exclude': An array of contexts to exclude from testing. The valid values are:
63 * ["document", "element", "fragment", "detached", "html", "xhtml"]
64 * The "html" and "xhtml" values represent the type of document bein g queried. These are useful
65 * for tests that are affected by differences between HTML and XML, such as case sensitivity.
66 * 'level': An integer indicating the CSS or Selectors level in which the s elector being tested was introduced.
67 * 'testType': A bit-mapped flag indicating the type of test.
68 *
69 * Note: Interactive pseudo-classes (:active :hover and :focus) have not been te sted in this test suite.
70 */
71 var validSelectors = [
72 // Type Selector
73 {'name': "Type selector, matching html element", 'selector': "html", 'expect': ["html"], 'exclude': ["element", "fragment", "detached"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
74 {'name': "Type selector, matching html element", 'selector': "html", 'expect': [] /*no matches*/, 'exclude': ["document"], 'level': 1, 'testType': TEST_QSA_BASELINE},
75 {'name': "Type selector, matching body element", 'selector': "body", 'expect': ["body"], 'exclude': ["element", "fragment", "detached"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
76 {'name': "Type selector, matching body element", 'selector': "body", 'expect': [] /*no matches*/, 'exclude': ["document"], 'level': 1, 'testType': TEST_QSA_BASELINE},
77
78 // Universal Selector
79 // Testing "*" for entire an entire context node is handled separately.
80 {'name': "Universal selector, matching all children of element with specified ID", 'selector': "#universal>*", 'expect': ["universal-p1", "universal-h r1", "universal-pre1", "universal-p2", "universal-address1"], 'level': 2, 'testT ype': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
81 {'name': "Universal selector, matching all grandchildren of element with speci fied ID", 'selector': "#universal>*>*", 'expect': ["universal-code1", "universa l-span1", "universal-a1", "universal-code2"], 'level': 2, 'testT ype': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
82 {'name': "Universal selector, matching all children of empty element with spec ified ID", 'selector': "#empty>*", 'expect': [] /*no matches*/, 'level': 2, 'testT ype': TEST_QSA_BASELINE},
83 {'name': "Universal selector, matching all descendants of element with specifi ed ID", 'selector': "#universal *", 'expect': ["universal-p1", "universal-c ode1", "universal-hr1", "universal-pre1", "universal-span1", "universal-p2", "un iversal-a1", "universal-address1", "universal-code2", "universal-a2"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
84
85 // Attribute Selectors
86 // - presence [att]
87 {'name': "Attribute presence selector, matching align attribute with value", 'selector': ".attr-presence-div1[align]", 'expect': ["attr-presence-div1"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
88 {'name': "Attribute presence selector, matching align attribute with empty val ue", 'selector': ".attr-presence-div2[align]", 'expect': ["attr-presence-div2"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
89 {'name': "Attribute presence selector, matching title attribute, case insensit ivity", 'selector': "#attr-presence [TiTlE]", 'expect': ["attr-presence-a1", "attr-presence-span1"], 'exclude': ["xhtm l"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
90 {'name': "Attribute presence selector, not matching title attribute, case sens itivity", 'selector': "#attr-presence [TiTlE]", 'expect': [], 'exclude': ["html "], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
91 {'name': "Attribute presence selector, matching custom data-* attribute", 'selector': "[data-attr-presence]", 'expect': ["attr-presence-pre1", "attr-presence-blockquote1"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
92 {'name': "Attribute presence selector, not matching attribute with similar nam e", 'selector': ".attr-presence-div3[align], .attr-presence-div4[a lign]", 'expect': [] /*no matches*/, 'level': 2, 'testType': TEST_QSA_BASELINE},
93 {'name': "Attribute presence selector, matching attribute with non-ASCII chara cters", 'selector': "ul[data-中文]", 'expect': ["attr-presence-ul1"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
94 {'name': "Attribute presence selector, not matching default option without sel ected attribute", 'selector': "#attr-presence-select1 option[selected]", 'expect': [] /* no matches */, 'level': 2, 'testType': TEST_QSA_BASELINE},
95 {'name': "Attribute presence selector, matching option with selected attribute ", 'selector': "#attr-presence-select2 option[selected]", 'expect': ["attr-presence-select2-option4"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
96 {'name': "Attribute presence selector, matching multiple options with selected attributes", 'selector': "#attr-presence-select3 option[selected]", 'expect': ["attr-presence-select3-option2", "attr-presence-select3-optio n3"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
97
98 // - value [att=val]
99 {'name': "Attribute value selector, matching align attribute with value", 'selector': "#attr-value [align=\"center\"]", 'expect': ["attr-value-div1"], 'level': 2, 'tes tType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
100 {'name': "Attribute value selector, matching align attribute with empty value" , 'selector': "#attr-value [align=\"\"]", 'expect': ["attr-value-div2"], 'level': 2, 'tes tType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
101 {'name': "Attribute value selector, not matching align attribute with partial value", 'selector': "#attr-value [align=\"c\"]", 'expect': [] /*no matches*/, 'level': 2, 'tes tType': TEST_QSA_BASELINE},
102 {'name': "Attribute value selector, not matching align attribute with incorrec t value", 'selector': "#attr-value [align=\"centera\"]", 'expect': [] /*no matches*/, 'level': 2, 'tes tType': TEST_QSA_BASELINE},
103 {'name': "Attribute value selector, matching custom data-* attribute with unic ode escaped value", 'selector': "[data-attr-value=\"\\e9\"]", 'expect': ["attr-value-div3"], 'level': 2, 'tes tType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
104 {'name': "Attribute value selector, matching custom data-* attribute with esca ped character", 'selector': "[data-attr-value\_foo=\"\\e9\"]", 'expect': ["attr-value-div4"], 'level': 2, 'tes tType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
105 {'name': "Attribute value selector with single-quoted value, matching multiple inputs with type attributes", 'selector': "#attr-value input[type='hidden'],#at tr-value input[type='radio']", 'expect': ["attr-value-input3", "attr-value-inp ut4", "attr-value-input6", "attr-value-input8", "attr-value-input9"], 'level': 2 , 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
106 {'name': "Attribute value selector with double-quoted value, matching multiple inputs with type attributes", 'selector': "#attr-value input[type=\"hidden\"],# attr-value input[type='radio']", 'expect': ["attr-value-input3", "attr-value-inp ut4", "attr-value-input6", "attr-value-input8", "attr-value-input9"], 'level': 2 , 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
107 {'name': "Attribute value selector with unquoted value, matching multiple inpu ts with type attributes", 'selector': "#attr-value input[type=hidden],#attr -value input[type=radio]", 'expect': ["attr-value-input3", "attr-value-inp ut4", "attr-value-input6", "attr-value-input8", "attr-value-input9"], 'level': 2 , 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
108 {'name': "Attribute value selector, matching attribute with value using non-AS CII characters", 'selector': "[data-attr-value=中文]", 'expect': ["attr-value-div5"], 'level': 2, 'tes tType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
109
110 // - whitespace-separated list [att~=val]
111 {'name': "Attribute whitespace-separated list selector, matching class attribu te with value", 'selector': "#attr-whitespace [ class~=\"div1\"]", 'expect': ["attr-white space-div1"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
112 {'name': "Attribute whitespace-separated list selector, not matching class att ribute with empty value", 'selector': "#attr-whitespace [ class~=\"\"]", 'expect': [] /*no matc hes*/ , 'level': 2, 'testType': TEST_QSA_BASELINE},
113 {'name': "Attribute whitespace-separated list selector, not matching class att ribute with partial value", 'selector': "[data-attr-whitesp ace~=\"div\"]", 'expect': [] /*no matc hes*/ , 'level': 2, 'testType': TEST_QSA_BASELINE},
114 {'name': "Attribute whitespace-separated list selector, matching custom data-* attribute with unicode escaped value", 'selector': "[data-attr-whitesp ace~=\"\\0000e9\"]", 'expect': ["attr-white space-div4"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
115 {'name': "Attribute whitespace-separated list selector, matching custom data-* attribute with escaped character", 'selector': "[data-attr-whitesp ace\_foo~=\"\\e9\"]", 'expect': ["attr-white space-div5"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
116 {'name': "Attribute whitespace-separated list selector with single-quoted valu e, matching multiple links with rel attributes", 'selector': "#attr-whitespace a [rel~='bookmark'], #attr-whitespace a[rel~='nofollow']", 'expect': ["attr-white space-a1", "attr-whitespace-a2", "attr-whitespace-a3", "attr-whitespace-a5", "at tr-whitespace-a7"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASEL INE},
117 {'name': "Attribute whitespace-separated list selector with double-quoted valu e, matching multiple links with rel attributes", 'selector': "#attr-whitespace a [rel~=\"bookmark\"],#attr-whitespace a[rel~='nofollow']", 'expect': ["attr-white space-a1", "attr-whitespace-a2", "attr-whitespace-a3", "attr-whitespace-a5", "at tr-whitespace-a7"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASEL INE},
118 {'name': "Attribute whitespace-separated list selector with unquoted value, ma tching multiple links with rel attributes", 'selector': "#attr-whitespace a [rel~=bookmark], #attr-whitespace a[rel~=nofollow]", 'expect': ["attr-white space-a1", "attr-whitespace-a2", "attr-whitespace-a3", "attr-whitespace-a5", "at tr-whitespace-a7"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASEL INE},
119 {'name': "Attribute whitespace-separated list selector with double-quoted valu e, not matching value with space", 'selector': "#attr-whitespace a [rel~=\"book mark\"]", 'expect': [] /* no mat ches */, 'level': 2, 'testType': TEST_QSA_BASELINE},
120 {'name': "Attribute whitespace-separated list selector, matching title attribu te with value using non-ASCII characters", 'selector': "#attr-whitespace [ title~=中文]", 'expect': ["attr-white space-p1"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
121
122 // - hyphen-separated list [att|=val]
123 {'name': "Attribute hyphen-separated list selector, not matching unspecified l ang attribute", 'selector': "#attr-hyphen-div1[lang|=\"en\"]", 'expect': [ ] /*no matches*/, 'level': 2, 'testType': TEST_QSA_BASELINE},
124 {'name': "Attribute hyphen-separated list selector, matching lang attribute wi th exact value", 'selector': "#attr-hyphen-div2[lang|=\"fr\"]", 'expect': [ "attr-hyphen-div2"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASE LINE},
125 {'name': "Attribute hyphen-separated list selector, matching lang attribute wi th partial value", 'selector': "#attr-hyphen-div3[lang|=\"en\"]", 'expect': [ "attr-hyphen-div3"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASE LINE},
126 {'name': "Attribute hyphen-separated list selector, not matching incorrect val ue", 'selector': "#attr-hyphen-div4[lang|=\"es-AR\"]", 'expect': [ ] /*no matches*/, 'level': 2, 'testType': TEST_QSA_BASELINE},
127
128 // - substring begins-with [att^=val] (Level 3)
129 {'name': "Attribute begins with selector, matching href attributes beginning w ith specified substring", 'selector': "#attr-begins a[href^=\"http://www\"]", 'expect': ["attr-begins-a1", "attr-begins-a3"], 'l evel': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
130 {'name': "Attribute begins with selector, matching lang attributes beginning w ith specified substring, ", 'selector': "#attr-begins [lang^=\"en-\"]", 'expect': ["attr-begins-div2", "attr-begins-div4"], 'l evel': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
131 {'name': "Attribute begins with selector, not matching class attribute not beg inning with specified substring", 'selector': "#attr-begins [class^=apple]", 'expect': [] /*no matches*/, 'l evel': 3, 'testType': TEST_QSA_ADDITIONAL},
132 {'name': "Attribute begins with selector with single-quoted value, matching cl ass attribute beginning with specified substring", 'selector': "#attr-begins [class^=' apple']", 'expect': ["attr-begins-p1"], 'l evel': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
133 {'name': "Attribute begins with selector with double-quoted value, matching cl ass attribute beginning with specified substring", 'selector': "#attr-begins [class^=\" apple\"]", 'expect': ["attr-begins-p1"], 'l evel': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
134 {'name': "Attribute begins with selector with unquoted value, not matching cla ss attribute not beginning with specified substring", 'selector': "#attr-begins [class^= apple]", 'expect': [] /*no matches*/, 'l evel': 3, 'testType': TEST_QSA_ADDITIONAL},
135
136 // - substring ends-with [att\$=val] (Level 3)
137 {'name': "Attribute ends with selector, matching href attributes ending with s pecified substring", 'selector': "#attr-ends a[href\ $=\".org\"]", 'expect': ["attr-ends-a1", "attr-ends-a3"], 'level': 3, 'tes tType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
138 {'name': "Attribute ends with selector, matching lang attributes ending with s pecified substring, ", 'selector': "#attr-ends [lang\$ =\"-CH\"]", 'expect': ["attr-ends-div2", "attr-ends-div4"], 'level': 3, 'tes tType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
139 {'name': "Attribute ends with selector, not matching class attribute not endin g with specified substring", 'selector': "#attr-ends [class\ $=apple]", 'expect': [] /*no matches*/, 'level': 3, 'tes tType': TEST_QSA_ADDITIONAL},
140 {'name': "Attribute ends with selector with single-quoted value, matching clas s attribute ending with specified substring", 'selector': "#attr-ends [class\ $='apple ']", 'expect': ["attr-ends-p1"], 'level': 3, 'tes tType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
141 {'name': "Attribute ends with selector with double-quoted value, matching clas s attribute ending with specified substring", 'selector': "#attr-ends [class\ $=\"apple \"]", 'expect': ["attr-ends-p1"], 'level': 3, 'tes tType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
142 {'name': "Attribute ends with selector with unquoted value, not matching class attribute not ending with specified substring", 'selector': "#attr-ends [class\ $=apple ]", 'expect': [] /*no matches*/, 'level': 3, 'tes tType': TEST_QSA_ADDITIONAL},
143
144 // - substring contains [att*=val] (Level 3)
145 {'name': "Attribute contains selector, matching href attributes beginning with specified substring", 'selector': "#attr-contains a[hr ef*=\"http://www\"]", 'expect': ["attr-contains-a1", "attr-contains-a3"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
146 {'name': "Attribute contains selector, matching href attributes ending with sp ecified substring", 'selector': "#attr-contains a[hr ef*=\".org\"]", 'expect': ["attr-contains-a1", "attr-contains-a2"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
147 {'name': "Attribute contains selector, matching href attributes containing spe cified substring", 'selector': "#attr-contains a[hr ef*=\".example.\"]", 'expect': ["attr-contains-a1", "attr-contains-a3"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
148 {'name': "Attribute contains selector, matching lang attributes beginning with specified substring, ", 'selector': "#attr-contains [lan g*=\"en-\"]", 'expect': ["attr-contains-div2", "attr-contains-div6"] , 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
149 {'name': "Attribute contains selector, matching lang attributes ending with sp ecified substring, ", 'selector': "#attr-contains [lan g*=\"-CH\"]", 'expect': ["attr-contains-div3", "attr-contains-div5"] , 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
150 {'name': "Attribute contains selector with single-quoted value, matching class attribute beginning with specified substring", 'selector': "#attr-contains [cla ss*=' apple']", 'expect': ["attr-contains-p1"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
151 {'name': "Attribute contains selector with single-quoted value, matching class attribute ending with specified substring", 'selector': "#attr-contains [cla ss*='orange ']", 'expect': ["attr-contains-p1"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
152 {'name': "Attribute contains selector with single-quoted value, matching class attribute containing specified substring", 'selector': "#attr-contains [cla ss*='ple banana ora']", 'expect': ["attr-contains-p1"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
153 {'name': "Attribute contains selector with double-quoted value, matching class attribute beginning with specified substring", 'selector': "#attr-contains [cla ss*=\" apple\"]", 'expect': ["attr-contains-p1"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
154 {'name': "Attribute contains selector with double-quoted value, matching class attribute ending with specified substring", 'selector': "#attr-contains [cla ss*=\"orange \"]", 'expect': ["attr-contains-p1"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
155 {'name': "Attribute contains selector with double-quoted value, matching class attribute containing specified substring", 'selector': "#attr-contains [cla ss*=\"ple banana ora\"]", 'expect': ["attr-contains-p1"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
156 {'name': "Attribute contains selector with unquoted value, matching class attr ibute beginning with specified substring", 'selector': "#attr-contains [cla ss*= apple]", 'expect': ["attr-contains-p1"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
157 {'name': "Attribute contains selector with unquoted value, matching class attr ibute ending with specified substring", 'selector': "#attr-contains [cla ss*=orange ]", 'expect': ["attr-contains-p1"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
158 {'name': "Attribute contains selector with unquoted value, matching class attr ibute containing specified substring", 'selector': "#attr-contains [cla ss*= banana ]", 'expect': ["attr-contains-p1"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
159
160 // Pseudo-classes
161 // - :root (Level 3)
162 {'name': ":root pseudo-class selector, matching document root element", ' selector': ":root", 'expect': ["html"], 'exclude': ["element", "fragmen t", "detached"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELI NE},
163 {'name': ":root pseudo-class selector, not matching document root element", ' selector': ":root", 'expect': [] /*no matches*/, 'exclude': ["document"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL},
164
165 // - :nth-child(n) (Level 3)
166 {'name': ":nth-child selector, matching the third child element", 'selector': "#pseudo-nth-table1 :nth-child(3)", 'expect': ["pse udo-nth-td3", "pseudo-nth-td9", "pseudo-nth-tr3", "pseudo-nth-td15"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
167 {'name': ":nth-child selector, matching every third child element", 'selector': "#pseudo-nth li:nth-child(3n)", 'expect': ["pse udo-nth-li3", "pseudo-nth-li6", "pseudo-nth-li9", "pseudo-nth-li12"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
168 {'name': ":nth-child selector, matching every second child element, starting f rom the fourth", 'selector': "#pseudo-nth li:nth-child(2n+4)", 'expect': ["pse udo-nth-li4", "pseudo-nth-li6", "pseudo-nth-li8", "pseudo-nth-li10", "pseudo-nth -li12"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
169 {'name': ":nth-child selector, matching every fourth child element, starting f rom the third", 'selector': "#pseudo-nth-p1 :nth-child(4n-1)", 'expect': ["pse udo-nth-em2", "pseudo-nth-span3"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
170
171 // - :nth-last-child (Level 3)
172 {'name': ":nth-last-child selector, matching the third last child element", 'selector': "#pseudo-nth-table1 :nth-las t-child(3)", 'expect': ["pseudo-nth-tr1", "pseudo-nth-td4", "pseudo-nth-td10", " pseudo-nth-td16"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
173 {'name': ":nth-last-child selector, matching every third child element from th e end", 'selector': "#pseudo-nth li:nth-last-chi ld(3n)", 'expect': ["pseudo-nth-li1", "pseudo-nth-li4", "pseudo-nth-li7", "p seudo-nth-li10"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
174 {'name': ":nth-last-child selector, matching every second child element from t he end, starting from the fourth last", 'selector': "#pseudo-nth li:nth-last-chi ld(2n+4)", 'expect': ["pseudo-nth-li1", "pseudo-nth-li3", "pseudo-nth-li5", "p seudo-nth-li7", "pseudo-nth-li9"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
175 {'name': ":nth-last-child selector, matching every fourth element from the end , starting from the third last", 'selector': "#pseudo-nth-p1 :nth-last-ch ild(4n-1)", 'expect': ["pseudo-nth-span2", "pseudo-nth-span4"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
176
177 // - :nth-of-type(n) (Level 3)
178 {'name': ":nth-of-type selector, matching the third em element", 'selector': "#pseudo-nth-p1 em:nth-of-type(3)", ' expect': ["pseudo-nth-em3"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_ MATCH_BASELINE},
179 {'name': ":nth-of-type selector, matching every second element of their type", 'selector': "#pseudo-nth-p1 :nth-of-type(2n)", ' expect': ["pseudo-nth-em2", "pseudo-nth-span2", "pseudo-nth-span4", "pseudo-nth- strong2", "pseudo-nth-em4"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_ MATCH_BASELINE},
180 {'name': ":nth-of-type selector, matching every second elemetn of their type, starting from the first", 'selector': "#pseudo-nth-p1 span:nth-of-type(2n-1)", ' expect': ["pseudo-nth-span1", "pseudo-nth-span3"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_ MATCH_BASELINE},
181
182 // - :nth-last-of-type(n) (Level 3)
183 {'name': ":nth-last-of-type selector, matching the thrid last em element", 'se lector': "#pseudo-nth-p1 em:nth-last-of-type(3)", 'expect': ["pseudo-nth-em 2"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
184 {'name': ":nth-last-of-type selector, matching every second last element of th eir type", 'selector': "#pseudo-nth-p1 :nth-last-of-type(2n)", 'expect': [ "pseudo-nth-span1", "pseudo-nth-em1", "pseudo-nth-strong1", "pseudo-nth-em3", "p seudo-nth-span3"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASE LINE},
185 {'name': ":nth-last-of-type selector, matching every second last element of th eir type, starting from the last", 'selector': "#pseudo-nth-p1 span:nth-last-of- type(2n-1)", 'expect': ["pseudo-nth-span2", "pseudo-nth-span4"], 'level': 3, 'testType': TEST_QSA_ADDI TIONAL | TEST_MATCH_BASELINE},
186
187 // - :first-of-type (Level 3)
188 {'name': ":first-of-type selector, matching the first em element", 'selector': "#pseudo-nth-p1 em:first-of-type", 'expect': ["pseudo-nth-em1"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | T EST_MATCH_BASELINE},
189 {'name': ":first-of-type selector, matching the first of every type of element ", 'selector': "#pseudo-nth-p1 :first-of-type", 'expect': ["pseudo-nth-sp an1", "pseudo-nth-em1", "pseudo-nth-strong1"], 'level': 3, 'testType': TEST_QSA_ ADDITIONAL | TEST_MATCH_BASELINE},
190 {'name': ":first-of-type selector, matching the first td element in each table row", 'selector': "#pseudo-nth-table1 tr :first-of-type", 'expect': ["pseudo-nt h-td1", "pseudo-nth-td7", "pseudo-nth-td13"], 'level': 3, 'testType': TEST_ QSA_ADDITIONAL | TEST_MATCH_BASELINE},
191
192 // - :last-of-type (Level 3)
193 {'name': ":last-of-type selector, matching the last em elemnet", 'selector': " #pseudo-nth-p1 em:last-of-type", 'expect': ["pseudo-nth-em4"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST _MATCH_BASELINE},
194 {'name': ":last-of-type selector, matching the last of every type of element", 'selector': "#pseudo-nth-p1 :last-of-type", 'expect': ["pseudo-nth-span4 ", "pseudo-nth-strong2", "pseudo-nth-em4"], 'level': 3, 'testType': TEST_QSA_ADD ITIONAL | TEST_MATCH_BASELINE},
195 {'name': ":last-of-type selector, matching the last td element in each table r ow", 'selector': "#pseudo-nth-table1 tr :last-of-type", 'expect': ["pseudo-nth-t d6", "pseudo-nth-td12", "pseudo-nth-td18"], 'level': 3, 'testType': TEST_QSA _ADDITIONAL | TEST_MATCH_BASELINE},
196
197 // - :first-child
198 {'name': ":first-child pseudo-class selector, matching first child div element ", 'selector': "#pseudo-first-child div:first-child", 'expect': ["pseudo-first-child-div1"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
199 {'name': ":first-child pseudo-class selector, doesn't match non-first-child el ements", 'selector': ".pseudo-first-child-div2:first-child, .pseudo-first-chi ld-div3:first-child", 'expect': [] /*no matches*/, 'level': 2, 'testType': TEST_QSA_BASELINE} ,
200 {'name': ":first-child pseudo-class selector, matching first-child of multiple elements", 'selector': "#pseudo-first-child span:first-child", 'expect': ["pseudo-first-child-span1", "pseudo-first-child -span3", "pseudo-first-child-span5"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
201
202 // - :last-child (Level 3)
203 {'name': ":last-child pseudo-class selector, matching last child div element", 'selector': "#pseudo-last-child div:last-child", 'expect': ["pseudo-last-child-div3"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TES T_MATCH_BASELINE},
204 {'name': ":last-child pseudo-class selector, doesn't match non-last-child elem ents", 'selector': ".pseudo-last-child-div1:last-child, .pseudo-last-child-d iv2:first-child", 'expect': [] /*no matches*/, 'level': 3, 'testType': TEST_QSA_ADDITIONAL},
205 {'name': ":last-child pseudo-class selector, matching first-child of multiple elements", 'selector': "#pseudo-last-child span:last-child", 'expect': ["pseudo-last-child-span2", "pseudo-last-child-span4 ", "pseudo-last-child-span6"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TES T_MATCH_BASELINE},
206
207 // - :only-child (Level 3)
208 {'name': ":pseudo-only-child pseudo-class selector, matching all only-child el ements", 'selector': "#pseudo-only :only-child", 'expect': ["pseudo-only-span1"] , 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
209 {'name': ":pseudo-only-child pseudo-class selector, matching only-child em ele ments", 'selector': "#pseudo-only em:only-child", 'expect': [] /*no matches*/, 'level': 3, 'testType': TEST_QSA_ADDITIONAL},
210
211 // - :only-of-type (Level 3)
212 {'name': ":pseudo-only-of-type pseudo-class selector, matching all elements wi th no siblings of the same type", 'selector': "#pseudo-only :only-of-type", 'exp ect': ["pseudo-only-span1", "pseudo-only-em1"], 'level': 3, 'testType': TEST_QSA _ADDITIONAL | TEST_MATCH_BASELINE},
213 {'name': ":pseudo-only-of-type pseudo-class selector, matching em elements wit h no siblings of the same type", 'selector': "#pseudo-only em:only-of-type", 'e xpect': ["pseudo-only-em1"], 'level': 3, 'testType': TEST_QSA _ADDITIONAL | TEST_MATCH_BASELINE},
214
215 // - :empty (Level 3)
216 {'name': ":empty pseudo-class selector, matching empty p elements", 'selecto r': "#pseudo-empty p:empty", 'expect': ["pseudo-empty-p1", "pseudo-empty-p2"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BA SELINE},
217 {'name': ":empty pseudo-class selector, matching all empty elements", 'selecto r': "#pseudo-empty :empty", 'expect': ["pseudo-empty-p1", "pseudo-empty-p2", "p seudo-empty-span1"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BA SELINE},
218
219 // - :link and :visited
220 // Implementations may treat all visited links as unvisited, so these cannot b e tested separately.
221 // The only guarantee is that ":link,:visited" matches the set of all visited and unvisited links and that they are individually mutually exclusive sets.
222 {'name': ":link and :visited pseudo-class selectors, matching a and area eleme nts with href attributes", 'selector': "#pseudo-link :link, #pseudo-link :visited", 'expect': ["pseudo-link-a1", "pseudo-link-a2", "pseudo-link-area1"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_ MATCH_BASELINE},
223 {'name': ":link and :visited pseudo-class selectors, matching link elements wi th href attributes", 'selector': "#head :link, #head :visited", 'expect': ["pseudo-link-link1", "pseudo-link-link2"], 'exclude': ["el ement", "fragment", "detached"], 'level': 1, 'testType': TEST_QSA_BASELINE | TES T_MATCH_BASELINE},
224 {'name': ":link and :visited pseudo-class selectors, not matching link element s with href attributes", 'selector': "#head :link, #head :visited", 'expect': [] /*no matches*/, 'exclude': ["do cument"], 'level': 1, 'testType': TEST_QSA_BASELINE},
225 {'name': ":link and :visited pseudo-class selectors, chained, mutually exclusi ve pseudo-classes match nothing", 'selector': ":link:visited", 'expect': [] /*no matches*/, 'exclude': ["do cument"], 'level': 1, 'testType': TEST_QSA_BASELINE},
226
227 // - :target (Level 3)
228 {'name': ":target pseudo-class selector, matching the element referenced by th e URL fragment identifier", 'selector': ":target", 'expect': [] /*no matches*/, 'exclude': ["document", "element"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL },
229 {'name': ":target pseudo-class selector, matching the element referenced by th e URL fragment identifier", 'selector': ":target", 'expect': ["target"], 'exclude': ["fragment", "detached"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
230
231 // - :lang()
232 {'name': ":lang pseudo-class selector, matching inherited language", 'selector': "#pseudo-lang-div1:lang(en)", 'expect': ["pseudo-lang- div1"], 'exclude': ["detached", "fragment"], 'level': 2, 'testType': TEST_QSA_BA SELINE | TEST_MATCH_BASELINE},
233 {'name': ":lang pseudo-class selector, not matching element with no inherited language", 'selector': "#pseudo-lang-div1:lang(en)", 'expect': [] /*no matche s*/, 'exclude': ["document", "element"], 'level': 2, 'testType': TEST_QSA_BA SELINE},
234 {'name': ":lang pseudo-class selector, matching specified language with exact value", 'selector': "#pseudo-lang-div2:lang(fr)", 'expect': ["pseudo-lang- div2"], 'level': 2, 'testType': TEST_QSA_BASE LINE | TEST_MATCH_BASELINE},
235 {'name': ":lang pseudo-class selector, matching specified language with partia l value", 'selector': "#pseudo-lang-div3:lang(en)", 'expect': ["pseudo-lang- div3"], 'level': 2, 'testType': TEST_QSA_BASE LINE | TEST_MATCH_BASELINE},
236 {'name': ":lang pseudo-class selector, not matching incorrect language", 'selector': "#pseudo-lang-div4:lang(es-AR)", 'expect': [] /*no matche s*/, 'level': 2, 'testType': TEST_QSA_BASE LINE},
237
238 // - :enabled (Level 3)
239 {'name': ":enabled pseudo-class selector, matching all enabled form controls", 'selector': "#pseudo-ui :enabled", 'expect': ["pseudo-ui-input1", "pseudo-ui- input2", "pseudo-ui-input3", "pseudo-ui-input4", "pseudo-ui-input5", "pseudo-ui- input6",
240 "pseudo-ui-input7", "pseudo-ui-input8 ", "pseudo-ui-input9", "pseudo-ui-textarea1", "pseudo-ui-button1"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
241
242 // - :disabled (Level 3)
243 {'name': ":enabled pseudo-class selector, matching all disabled form controls" , 'selector': "#pseudo-ui :disabled", 'expect': ["pseudo-ui-input10", "pseudo-ui -input11", "pseudo-ui-input12", "pseudo-ui-input13", "pseudo-ui-input14", "pseud o-ui-input15",
244 "pseudo-ui-input16", "pseudo-ui-input 17", "pseudo-ui-input18", "pseudo-ui-textarea2", "pseudo-ui-button2"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
245
246 // - :checked (Level 3)
247 {'name': ":checked pseudo-class selector, matching checked radio buttons and c heckboxes", 'selector': "#pseudo-ui :checked", 'expect': ["pseudo-ui-input4", "p seudo-ui-input6", "pseudo-ui-input13", "pseudo-ui-input15"], 'level': 3, 'testT ype': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
248
249 // - :not(s) (Level 3)
250 {'name': ":not pseudo-class selector, matching ", 'selector': "#not>:not(div)" , 'expect': ["not-p1", "not-p2", "not-p3"], 'level': 3, 'testType': TEST_QSA_A DDITIONAL | TEST_MATCH_BASELINE},
251 {'name': ":not pseudo-class selector, matching ", 'selector': "#not * :not(:fi rst-child)", 'expect': ["not-em1", "not-em2", "not-em3"], 'level': 3, 'testTyp e': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
252 {'name': ":not pseudo-class selector, matching nothing", 'selector': ":not(*)" , 'expect': [] /* no matches */, 'level': 3, 'testType': TEST_QSA_ADDITIONAL},
253 {'name': ":not pseudo-class selector, matching nothing", 'selector': ":not(*|* )", 'expect': [] /* no matches */, 'level': 3, 'testType': TEST_QSA_ADDITIONAL},
254
255 // Pseudo-elements
256 // - ::first-line
257 {'name': ":first-line pseudo-element (one-colon syntax) selector, not matching any elements", 'selector': "#pseudo-element:first-line", 'expect': [] /*n o matches*/, 'level': 2, 'testType': TEST_QSA_BASELINE},
258 {'name': "::first-line pseudo-element (two-colon syntax) selector, not matchin g any elements", 'selector': "#pseudo-element::first-line", 'expect': [] /*n o matches*/, 'level': 3, 'testType': TEST_QSA_ADDITIONAL},
259
260 // - ::first-letter
261 {'name': ":first-letter pseudo-element (one-colon syntax) selector, not matchi ng any elements", 'selector': "#pseudo-element:first-letter", 'expect': [] /*n o matches*/, 'level': 2, 'testType': TEST_QSA_BASELINE},
262 {'name': "::first-letter pseudo-element (two-colon syntax) selector, not match ing any elements", 'selector': "#pseudo-element::first-letter", 'expect': [] /*n o matches*/, 'level': 3, 'testType': TEST_QSA_ADDITIONAL},
263
264 // - ::before
265 {'name': ":before pseudo-element (one-colon syntax) selector, not matching any elements", 'selector': "#pseudo-element:before", 'expect': [] /*n o matches*/, 'level': 2, 'testType': TEST_QSA_BASELINE},
266 {'name': "::before pseudo-element (two-colon syntax) selector, not matching an y elements", 'selector': "#pseudo-element::before", 'expect': [] /*n o matches*/, 'level': 3, 'testType': TEST_QSA_ADDITIONAL},
267
268 // - ::after
269 {'name': ":after pseudo-element (one-colon syntax) selector, not matching any elements", 'selector': "#pseudo-element:after", 'expect': [] /*n o matches*/, 'level': 2, 'testType': TEST_QSA_BASELINE},
270 {'name': "::after pseudo-element (two-colon syntax) selector, not matching any elements", 'selector': "#pseudo-element::after", 'expect': [] /*n o matches*/, 'level': 3, 'testType': TEST_QSA_ADDITIONAL},
271
272 // Class Selectors
273 {'name': "Class selector, matching element with specified class", 'selector': ".class-p", 'expect': [ "class-p1","class-p2", "class-p3"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
274 {'name': "Class selector, chained, matching only elements with all specified c lasses", 'selector': "#class .apple.orange.banana", 'exp ect': ["class-div1", "class-div2", "class-p4", "class-div3", "class-p6", "class- div4"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
275 {'name': "Class Selector, chained, with type selector", 'selector': "div.apple.banana.orange", 'expect': [ "class-div1", "class-div2", "class-div3", "class-div4"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
276 // Caution: If copying and pasting the folowing non-ASCII classes, ensure unic ode normalisation is not performed in the process.
277 {'name': "Class selector, matching element with class value using non-ASCII ch aracters", 'selector': ".台北Táiběi", 'expect': [ "class-span1"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_M ATCH_BASELINE},
278 {'name': "Class selector, matching multiple elements with class value using no n-ASCII characters", 'selector': ".台北", 'expect': [ "class-span1","class-span2"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_M ATCH_BASELINE},
279 {'name': "Class selector, chained, matching element with multiple class values using non-ASCII characters", 'selector': ".台北Táiběi.台北", 'expect': [ "class-span1"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_M ATCH_BASELINE},
280 {'name': "Class selector, matching element with class with escaped character", 'selector': ".foo\\:bar", 'expect': [ "class-span3"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_M ATCH_BASELINE},
281 {'name': "Class selector, matching element with class with escaped character", 'selector': ".test\\.foo\\[5\\]bar", 'expect': [ "class-span4"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_M ATCH_BASELINE},
282
283 // ID Selectors
284 {'name': "ID selector, matching element with specified id", 'selecto r': "#id #id-div1", 'expect': ["id-div1"], 'level': 1, ' testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
285 {'name': "ID selector, chained, matching element with specified id", 'selecto r': "#id-div1, #id-div1", 'expect': ["id-div1"], 'level': 1, ' testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
286 {'name': "ID selector, chained, matching element with specified id", 'selecto r': "#id-div1, #id-div2", 'expect': ["id-div1", "id-div2"], 'level': 1, ' testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
287 {'name': "ID Selector, chained, with type selector", 'selecto r': "div#id-div1, div#id-div2", 'expect': ["id-div1", "id-div2"], 'level': 1, ' testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
288 {'name': "ID selector, not matching non-existent descendant", 'selecto r': "#id #none", 'expect': [] /*no matches*/, 'level': 1, ' testType': TEST_QSA_BASELINE},
289 {'name': "ID selector, not matching non-existent ancestor", 'selecto r': "#none #id-div1", 'expect': [] /*no matches*/, 'level': 1, ' testType': TEST_QSA_BASELINE},
290 {'name': "ID selector, matching multiple elements with duplicate id", 'selecto r': "#id-li-duplicate", 'expect': ["id-li-duplicate", "id-li-duplicate" , "id-li-duplicate", "id-li-duplicate"], 'level': 1, 'testType': TEST_QSA_BASELI NE | TEST_MATCH_BASELINE},
291
292 // Caution: If copying and pasting the folowing non-ASCII IDs, ensure unicode normalisation is not performed in the process.
293 {'name': "ID selector, matching id value using non-ASCII characters", 'sele ctor': "#台北Táiběi", 'expect': ["台北Táiběi"], 'level': 1, 'tes tType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
294 {'name': "ID selector, matching id value using non-ASCII characters", 'sele ctor': "#台北", 'expect': ["台北"], 'level': 1, 'tes tType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
295 {'name': "ID selector, matching id values using non-ASCII characters", 'sele ctor': "#台北Táiběi, #台北", 'expect': ["台北Táiběi", "台北"], 'level': 1, 'tes tType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
296
297 // XXX runMatchesTest() in level2-lib.js can't handle this because obtaining t he expected nodes requires escaping characters when generating the selector from 'expect' values
298 {'name': "ID selector, matching element with id with escaped character", 'sele ctor': "#\\#foo\\:bar", 'expect': ["#foo:bar"], 'level': 1, 'tes tType': TEST_QSA_BASELINE},
299 {'name': "ID selector, matching element with id with escaped character", 'sele ctor': "#test\\.foo\\[5\\]bar", 'expect': ["test.foo[5]bar"], 'level': 1, 'tes tType': TEST_QSA_BASELINE},
300
301 // Namespaces
302 // XXX runMatchesTest() in level2-lib.js can't handle these because non-HTML e lements don't have a recognised id
303 {'name': "Namespace selector, matching element with any namespace", 'se lector': "#any-namespace *|div", 'expect': ["any-namespace-div1", "any-namespace -div2", "any-namespace-div3", "any-namespace-div4"], 'level': 3, 'testType': TES T_QSA_BASELINE},
304 {'name': "Namespace selector, matching div elements in no namespace only", 'se lector': "#no-namespace |div", 'expect': ["no-namespace-div3"], 'level': 3, 't estType': TEST_QSA_BASELINE},
305 {'name': "Namespace selector, matching any elements in no namespace only", 'se lector': "#no-namespace |*", 'expect': ["no-namespace-div3"], 'level': 3, 't estType': TEST_QSA_BASELINE},
306
307 // Combinators
308 // - Descendant combinator ' '
309 {'name': "Descendant combinator, matching element that is a descendant of an e lement with id", 'selector': "#descendant div", 'expect': ["descendant-div1", "descendant-div2", "descendant-div3", "descendan t-div4"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
310 {'name': "Descendant combinator, matching element with id that is a descendant of an element", 'selector': "body #descendant-div1", 'expect': ["descendant-div1"], 'exclude': ["detached", "fragment"], 'level': 1 , 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
311 {'name': "Descendant combinator, matching element with id that is a descendant of an element", 'selector': "div #descendant-div1", 'expect': ["descendant-div1"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
312 {'name': "Descendant combinator, matching element with id that is a descendant of an element with id", 'selector': "#descendant #descendant-div2", 'expect': ["descendant-div2"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
313 {'name': "Descendant combinator, matching element with class that is a descend ant of an element with id", 'selector': "#descendant .descendant-div2", 'expect': ["descendant-div2"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
314 {'name': "Descendant combinator, matching element with class that is a descend ant of an element with class", 'selector': ".descendant-div1 .descendant-div3" , 'expect': ["descendant-div3"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
315 {'name': "Descendant combinator, not matching element with id that is not a de scendant of an element with id", 'selector': "#descendant-div1 #descendant-div4" , 'expect': [] /*no matches*/, 'level': 1, 'testType': TEST_QSA_BASELINE},
316 {'name': "Descendant combinator, whitespace characters", 'selector': "#descendant\t\r\n#descendant-div2" , 'expect': ["descendant-div2"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
317
318 // - Child combinator '>'
319 {'name': "Child combinator, matching element that is a child of an element wit h id", 'selector': "#child>div", 'expect': ["child-div1", "child-div4"], 'level': 2, 'testType': TEST_QSA_BASELIN E | TEST_MATCH_BASELINE},
320 {'name': "Child combinator, matching element with id that is a child of an ele ment", 'selector': "div>#child-div1", 'expect': ["child-div1"], 'level': 2, 'testType': TEST_QSA_BASELIN E | TEST_MATCH_BASELINE},
321 {'name': "Child combinator, matching element with id that is a child of an ele ment with id", 'selector': "#child>#child-div1", 'expect': ["child-div1"], 'level': 2, 'testType': TEST_QSA_BASELIN E | TEST_MATCH_BASELINE},
322 {'name': "Child combinator, matching element with id that is a child of an ele ment with class", 'selector': "#child-div1>.child-div2", 'expect': ["child-div2"], 'level': 2, 'testType': TEST_QSA_BASELIN E | TEST_MATCH_BASELINE},
323 {'name': "Child combinator, matching element with class that is a child of an element with class", 'selector': ".child-div1>.child-div2", 'expect': ["child-div2"], 'level': 2, 'testType': TEST_QSA_BASELIN E | TEST_MATCH_BASELINE},
324 {'name': "Child combinator, not matching element with id that is not a child o f an element with id", 'selector': "#child>#child-div3", 'expect': [] /*no matches*/, 'level': 2, 'testType': TEST_QSA_BASELIN E},
325 {'name': "Child combinator, not matching element with id that is not a child o f an element with class", 'selector': "#child-div1>.child-div3", 'expect': [] /*no matches*/, 'level': 2, 'testType': TEST_QSA_BASELIN E},
326 {'name': "Child combinator, not matching element with class that is not a chil d of an element with class", 'selector': ".child-div1>.child-div3", 'expect': [] /*no matches*/, 'level': 2, 'testType': TEST_QSA_BASELIN E},
327 {'name': "Child combinator, surrounded by whitespace", 'selector': "#child-div1\t\r\n>\t\r\n#child-div2", 'expect': ["child-div2"], 'level': 2, 'testType': TEST_QSA_BASELIN E | TEST_MATCH_BASELINE},
328 {'name': "Child combinator, whitespace after", 'selector': "#child-div1>\t\r\n#child-div2", 'expect': ["child-div2"], 'level': 2, 'testType': TEST_QSA_BASELIN E | TEST_MATCH_BASELINE},
329 {'name': "Child combinator, whitespace before", 'selector': "#child-div1\t\r\n>#child-div2", 'expect': ["child-div2"], 'level': 2, 'testType': TEST_QSA_BASELIN E | TEST_MATCH_BASELINE},
330 {'name': "Child combinator, no whitespace", 'selector': "#child-div1>#child-div2", 'expect': ["child-div2"], 'level': 2, 'testType': TEST_QSA_BASELIN E | TEST_MATCH_BASELINE},
331
332 // - Adjacent sibling combinator '+'
333 {'name': "Adjacent sibling combinator, matching element that is an adjacent si bling of an element with id", 'selector': "#adjacent-div2+div", 'expect': ["adjacent-div4"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
334 {'name': "Adjacent sibling combinator, matching element with id that is an adj acent sibling of an element", 'selector': "div+#adjacent-div4", 'expect': ["adjacent-div4"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
335 {'name': "Adjacent sibling combinator, matching element with id that is an adj acent sibling of an element with id", 'selector': "#adjacent-div2+#adjac ent-div4", 'expect': ["adjacent-div4"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
336 {'name': "Adjacent sibling combinator, matching element with class that is an adjacent sibling of an element with id", 'selector': "#adjacent-div2+.adjac ent-div4", 'expect': ["adjacent-div4"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
337 {'name': "Adjacent sibling combinator, matching element with class that is an adjacent sibling of an element with class", 'selector': ".adjacent-div2+.adjac ent-div4", 'expect': ["adjacent-div4"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
338 {'name': "Adjacent sibling combinator, matching p element that is an adjacent sibling of a div element", 'selector': "#adjacent div+p", 'expect': ["adjacent-p2"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
339 {'name': "Adjacent sibling combinator, not matching element with id that is no t an adjacent sibling of an element with id", 'selector': "#adjacent-div2+#adjac ent-p2, #adjacent-div2+#adjacent-div1", 'expect': [] /*no matches*/, 'level': 2, 'testType': TEST_QSA_BASELINE},
340 {'name': "Adjacent sibling combinator, surrounded by whitespace", 'selector': "#adjacent-p2\t\r\n+\t \r\n#adjacent-p3", 'expect': ["adjacent-p3"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
341 {'name': "Adjacent sibling combinator, whitespace after", 'selector': "#adjacent-p2+\t\r\n#a djacent-p3", 'expect': ["adjacent-p3"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
342 {'name': "Adjacent sibling combinator, whitespace before", 'selector': "#adjacent-p2\t\r\n+#a djacent-p3", 'expect': ["adjacent-p3"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
343 {'name': "Adjacent sibling combinator, no whitespace", 'selector': "#adjacent-p2+#adjacen t-p3", 'expect': ["adjacent-p3"], 'level': 2, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
344
345 // - General sibling combinator ~ (Level 3)
346 {'name': "General sibling combinator, matching element that is a sibling of an element with id", 'selector': "#sibling-div2~div", 'expect': ["sibling-div4", "sibling-div6"], 'level ': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
347 {'name': "General sibling combinator, matching element with id that is a sibli ng of an element", 'selector': "div~#sibling-div4", 'expect': ["sibling-div4"], 'level ': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
348 {'name': "General sibling combinator, matching element with id that is a sibli ng of an element with id", 'selector': "#sibling-div2~#sibling-div4", 'expect': ["sibling-div4"], 'level ': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
349 {'name': "General sibling combinator, matching element with class that is a si bling of an element with id", 'selector': "#sibling-div2~.sibling-div", 'expect': ["sibling-div4", "sibling-div6"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
350 {'name': "General sibling combinator, matching p element that is a sibling of a div element", 'selector': "#sibling div~p", 'expect': ["sibling-p2", "sibling-p3"], 'level': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
351 {'name': "General sibling combinator, not matching element with id that is not a sibling after a p element", 'selector': "#sibling>p~div", 'expect': [] /*no matches*/, 'level ': 3, 'testType': TEST_QSA_ADDITIONAL},
352 {'name': "General sibling combinator, not matching element with id that is not a sibling after an element with id", 'selector': "#sibling-div2~#sibling-div3, #sibling-div2~#sibling-div1", 'expect': [] /*no matches*/, 'level ': 3, 'testType': TEST_QSA_ADDITIONAL},
353 {'name': "General sibling combinator, surrounded by whitespace", 'selector': "#sibling-p2\t\r\n~\t\r\n#sibl ing-p3", 'expect': ["sibling-p3"], 'level ': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
354 {'name': "General sibling combinator, whitespace after", 'selector': "#sibling-p2~\t\r\n#sibling-p3 ", 'expect': ["sibling-p3"], 'level ': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
355 {'name': "General sibling combinator, whitespace before", 'selector': "#sibling-p2\t\r\n~#sibling-p3 ", 'expect': ["sibling-p3"], 'level ': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
356 {'name': "General sibling combinator, no whitespace", 'selector': "#sibling-p2~#sibling-p3", 'expect': ["sibling-p3"], 'level ': 3, 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE},
357
358 // Group of selectors (comma)
359 {'name': "Syntax, group of selectors separator, surrounded by whitespace", 'se lector': "#group em\t\r \n,\t\r \n#group strong", 'expect': ["group-em1", "group -strong1"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
360 {'name': "Syntax, group of selectors separator, whitespace after", 'se lector': "#group em,\t\r\n#group strong", 'expect': ["group-em1", "group -strong1"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
361 {'name': "Syntax, group of selectors separator, whitespace before", 'se lector': "#group em\t\r\n,#group strong", 'expect': ["group-em1", "group -strong1"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
362 {'name': "Syntax, group of selectors separator, no whitespace", 'se lector': "#group em,#group strong", 'expect': ["group-em1", "group -strong1"], 'level': 1, 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE},
363 ];
OLDNEW
« no previous file with comments | « pkg/third_party/html5lib/test/selectors/level1_lib.dart ('k') | pkg/third_party/html5lib/test/support.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698