OLD | NEW |
(Empty) | |
| 1 /// Test for the Selectors API ported from |
| 2 /// <https://github.com/w3c/web-platform-tests/tree/master/selectors-api> |
| 3 library html.test.selectors.selectors; |
| 4 |
| 5 // Bit-mapped flags to indicate which tests the selector is suitable for |
| 6 var TEST_QSA_BASELINE = |
| 7 0x01; // querySelector() and querySelectorAll() baseline tests |
| 8 var TEST_QSA_ADDITIONAL = |
| 9 0x02; // querySelector() and querySelectorAll() additional tests |
| 10 var TEST_FIND_BASELINE = |
| 11 0x04; // find() and findAll() baseline tests, may be unsuitable for querySel
ector[All] |
| 12 var TEST_FIND_ADDITIONAL = |
| 13 0x08; // find() and findAll() additional tests, may be unsuitable for queryS
elector[All] |
| 14 var TEST_MATCH_BASELINE = 0x10; // matches() baseline tests |
| 15 var TEST_MATCH_ADDITIONAL = 0x20; // matches() additional tests |
| 16 |
| 17 /* |
| 18 * All of these invalid selectors should result in a SyntaxError being thrown by
the APIs. |
| 19 * |
| 20 * name: A descriptive name of the selector being tested |
| 21 * selector: The selector to test |
| 22 */ |
| 23 var invalidSelectors = [ |
| 24 {'name': "Empty String", '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 character", 'selector': "}"}, |
| 31 {'name': "Invalid character", 'selector': "<"}, |
| 32 {'name': "Invalid character", 'selector': ">"}, |
| 33 {'name': "Invalid ID", 'selector': "#"}, |
| 34 {'name': "Invalid group of selectors", 'selector': "div,"}, |
| 35 {'name': "Invalid class", 'selector': "."}, |
| 36 {'name': "Invalid class", 'selector': ".5cm"}, |
| 37 {'name': "Invalid class", 'selector': "..test"}, |
| 38 {'name': "Invalid class", 'selector': ".foo..quux"}, |
| 39 {'name': "Invalid class", 'selector': ".bar."}, |
| 40 {'name': "Invalid combinator", 'selector': "div & address, p"}, |
| 41 {'name': "Invalid combinator", 'selector': "div >> address, p"}, |
| 42 {'name': "Invalid combinator", 'selector': "div ++ address, p"}, |
| 43 {'name': "Invalid combinator", 'selector': "div ~~ address, p"}, |
| 44 {'name': "Invalid [att=value] selector", 'selector': "[*=test]"}, |
| 45 {'name': "Invalid [att=value] selector", 'selector': "[*|*=test]"}, |
| 46 { |
| 47 'name': "Invalid [att=value] selector", |
| 48 'selector': "[class= space unquoted ]" |
| 49 }, |
| 50 {'name': "Unknown pseudo-class", 'selector': "div:example"}, |
| 51 {'name': "Unknown pseudo-class", 'selector': ":example"}, |
| 52 {'name': "Unknown pseudo-element", 'selector': "div::example"}, |
| 53 {'name': "Unknown pseudo-element", 'selector': "::example"}, |
| 54 {'name': "Invalid pseudo-element", 'selector': ":::before"}, |
| 55 {'name': "Undeclared namespace", 'selector': "ns|div"}, |
| 56 {'name': "Undeclared namespace", 'selector': ":not(ns|div)"}, |
| 57 {'name': "Invalid namespace", 'selector': "^|div"}, |
| 58 {'name': "Invalid namespace", 'selector': "\$|div"} |
| 59 ]; |
| 60 |
| 61 /* |
| 62 * All of these should be valid selectors, expected to match zero or more elemen
ts in the document. |
| 63 * None should throw any errors. |
| 64 * |
| 65 * name: A descriptive name of the selector being tested |
| 66 * selector: The selector to test |
| 67 * 'expect': A list of IDs of the elements expected to be matched. List must
be given in tree order. |
| 68 * 'exclude': An array of contexts to exclude from testing. The valid values
are: |
| 69 * ["document", "element", "fragment", "detached", "html", "xhtml"] |
| 70 * The "html" and "xhtml" values represent the type of document bein
g queried. These are useful |
| 71 * for tests that are affected by differences between HTML and XML,
such as case sensitivity. |
| 72 * 'level': An integer indicating the CSS or Selectors level in which the s
elector being tested was introduced. |
| 73 * 'testType': A bit-mapped flag indicating the type of test. |
| 74 * |
| 75 * Note: Interactive pseudo-classes (:active :hover and :focus) have not been te
sted in this test suite. |
| 76 */ |
| 77 var validSelectors = [ |
| 78 // Type Selector |
| 79 { |
| 80 'name': "Type selector, matching html element", |
| 81 'selector': "html", |
| 82 'expect': ["html"], |
| 83 'exclude': ["element", "fragment", "detached"], |
| 84 'level': 1, |
| 85 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 86 }, |
| 87 { |
| 88 'name': "Type selector, matching html element", |
| 89 'selector': "html", |
| 90 'expect': [] /*no matches*/, |
| 91 'exclude': ["document"], |
| 92 'level': 1, |
| 93 'testType': TEST_QSA_BASELINE |
| 94 }, |
| 95 { |
| 96 'name': "Type selector, matching body element", |
| 97 'selector': "body", |
| 98 'expect': ["body"], |
| 99 'exclude': ["element", "fragment", "detached"], |
| 100 'level': 1, |
| 101 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 102 }, |
| 103 { |
| 104 'name': "Type selector, matching body element", |
| 105 'selector': "body", |
| 106 'expect': [] /*no matches*/, |
| 107 'exclude': ["document"], |
| 108 'level': 1, |
| 109 'testType': TEST_QSA_BASELINE |
| 110 }, |
| 111 |
| 112 // Universal Selector |
| 113 // Testing "*" for entire an entire context node is handled separately. |
| 114 { |
| 115 'name': |
| 116 "Universal selector, matching all children of element with specified ID"
, |
| 117 'selector': "#universal>*", |
| 118 'expect': [ |
| 119 "universal-p1", |
| 120 "universal-hr1", |
| 121 "universal-pre1", |
| 122 "universal-p2", |
| 123 "universal-address1" |
| 124 ], |
| 125 'level': 2, |
| 126 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 127 }, |
| 128 { |
| 129 'name': |
| 130 "Universal selector, matching all grandchildren of element with specifie
d ID", |
| 131 'selector': "#universal>*>*", |
| 132 'expect': [ |
| 133 "universal-code1", |
| 134 "universal-span1", |
| 135 "universal-a1", |
| 136 "universal-code2" |
| 137 ], |
| 138 'level': 2, |
| 139 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 140 }, |
| 141 { |
| 142 'name': |
| 143 "Universal selector, matching all children of empty element with specifi
ed ID", |
| 144 'selector': "#empty>*", |
| 145 'expect': [] /*no matches*/, |
| 146 'level': 2, |
| 147 'testType': TEST_QSA_BASELINE |
| 148 }, |
| 149 { |
| 150 'name': |
| 151 "Universal selector, matching all descendants of element with specified
ID", |
| 152 'selector': "#universal *", |
| 153 'expect': [ |
| 154 "universal-p1", |
| 155 "universal-code1", |
| 156 "universal-hr1", |
| 157 "universal-pre1", |
| 158 "universal-span1", |
| 159 "universal-p2", |
| 160 "universal-a1", |
| 161 "universal-address1", |
| 162 "universal-code2", |
| 163 "universal-a2" |
| 164 ], |
| 165 'level': 2, |
| 166 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 167 }, |
| 168 |
| 169 // Attribute Selectors |
| 170 // - presence [att] |
| 171 { |
| 172 'name': "Attribute presence selector, matching align attribute with value", |
| 173 'selector': ".attr-presence-div1[align]", |
| 174 'expect': ["attr-presence-div1"], |
| 175 'level': 2, |
| 176 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 177 }, |
| 178 { |
| 179 'name': |
| 180 "Attribute presence selector, matching align attribute with empty value"
, |
| 181 'selector': ".attr-presence-div2[align]", |
| 182 'expect': ["attr-presence-div2"], |
| 183 'level': 2, |
| 184 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 185 }, |
| 186 { |
| 187 'name': |
| 188 "Attribute presence selector, matching title attribute, case insensitivi
ty", |
| 189 'selector': "#attr-presence [TiTlE]", |
| 190 'expect': ["attr-presence-a1", "attr-presence-span1"], |
| 191 'exclude': ["xhtml"], |
| 192 'level': 2, |
| 193 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 194 }, |
| 195 { |
| 196 'name': |
| 197 "Attribute presence selector, not matching title attribute, case sensiti
vity", |
| 198 'selector': "#attr-presence [TiTlE]", |
| 199 'expect': [], |
| 200 'exclude': ["html"], |
| 201 'level': 2, |
| 202 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 203 }, |
| 204 { |
| 205 'name': "Attribute presence selector, matching custom data-* attribute", |
| 206 'selector': "[data-attr-presence]", |
| 207 'expect': ["attr-presence-pre1", "attr-presence-blockquote1"], |
| 208 'level': 2, |
| 209 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 210 }, |
| 211 { |
| 212 'name': |
| 213 "Attribute presence selector, not matching attribute with similar name", |
| 214 'selector': ".attr-presence-div3[align], .attr-presence-div4[align]", |
| 215 'expect': [] /*no matches*/, |
| 216 'level': 2, |
| 217 'testType': TEST_QSA_BASELINE |
| 218 }, |
| 219 { |
| 220 'name': |
| 221 "Attribute presence selector, matching attribute with non-ASCII characte
rs", |
| 222 'selector': "ul[data-中文]", |
| 223 'expect': ["attr-presence-ul1"], |
| 224 'level': 2, |
| 225 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 226 }, |
| 227 { |
| 228 'name': |
| 229 "Attribute presence selector, not matching default option without select
ed attribute", |
| 230 'selector': "#attr-presence-select1 option[selected]", |
| 231 'expect': [] /* no matches */, |
| 232 'level': 2, |
| 233 'testType': TEST_QSA_BASELINE |
| 234 }, |
| 235 { |
| 236 'name': |
| 237 "Attribute presence selector, matching option with selected attribute", |
| 238 'selector': "#attr-presence-select2 option[selected]", |
| 239 'expect': ["attr-presence-select2-option4"], |
| 240 'level': 2, |
| 241 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 242 }, |
| 243 { |
| 244 'name': |
| 245 "Attribute presence selector, matching multiple options with selected at
tributes", |
| 246 'selector': "#attr-presence-select3 option[selected]", |
| 247 'expect': [ |
| 248 "attr-presence-select3-option2", |
| 249 "attr-presence-select3-option3" |
| 250 ], |
| 251 'level': 2, |
| 252 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 253 }, |
| 254 |
| 255 // - value [att=val] |
| 256 { |
| 257 'name': "Attribute value selector, matching align attribute with value", |
| 258 'selector': "#attr-value [align=\"center\"]", |
| 259 'expect': ["attr-value-div1"], |
| 260 'level': 2, |
| 261 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 262 }, |
| 263 { |
| 264 'name': |
| 265 "Attribute value selector, matching align attribute with empty value", |
| 266 'selector': "#attr-value [align=\"\"]", |
| 267 'expect': ["attr-value-div2"], |
| 268 'level': 2, |
| 269 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 270 }, |
| 271 { |
| 272 'name': |
| 273 "Attribute value selector, not matching align attribute with partial val
ue", |
| 274 'selector': "#attr-value [align=\"c\"]", |
| 275 'expect': [] /*no matches*/, |
| 276 'level': 2, |
| 277 'testType': TEST_QSA_BASELINE |
| 278 }, |
| 279 { |
| 280 'name': |
| 281 "Attribute value selector, not matching align attribute with incorrect v
alue", |
| 282 'selector': "#attr-value [align=\"centera\"]", |
| 283 'expect': [] /*no matches*/, |
| 284 'level': 2, |
| 285 'testType': TEST_QSA_BASELINE |
| 286 }, |
| 287 { |
| 288 'name': |
| 289 "Attribute value selector, matching custom data-* attribute with unicode
escaped value", |
| 290 'selector': "[data-attr-value=\"\\e9\"]", |
| 291 'expect': ["attr-value-div3"], |
| 292 'level': 2, |
| 293 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 294 }, |
| 295 { |
| 296 'name': |
| 297 "Attribute value selector, matching custom data-* attribute with escaped
character", |
| 298 'selector': "[data-attr-value\_foo=\"\\e9\"]", |
| 299 'expect': ["attr-value-div4"], |
| 300 'level': 2, |
| 301 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 302 }, |
| 303 { |
| 304 'name': |
| 305 "Attribute value selector with single-quoted value, matching multiple in
puts with type attributes", |
| 306 'selector': |
| 307 "#attr-value input[type='hidden'],#attr-value input[type='radio']", |
| 308 'expect': [ |
| 309 "attr-value-input3", |
| 310 "attr-value-input4", |
| 311 "attr-value-input6", |
| 312 "attr-value-input8", |
| 313 "attr-value-input9" |
| 314 ], |
| 315 'level': 2, |
| 316 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 317 }, |
| 318 { |
| 319 'name': |
| 320 "Attribute value selector with double-quoted value, matching multiple in
puts with type attributes", |
| 321 'selector': |
| 322 "#attr-value input[type=\"hidden\"],#attr-value input[type='radio']", |
| 323 'expect': [ |
| 324 "attr-value-input3", |
| 325 "attr-value-input4", |
| 326 "attr-value-input6", |
| 327 "attr-value-input8", |
| 328 "attr-value-input9" |
| 329 ], |
| 330 'level': 2, |
| 331 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 332 }, |
| 333 { |
| 334 'name': |
| 335 "Attribute value selector with unquoted value, matching multiple inputs
with type attributes", |
| 336 'selector': "#attr-value input[type=hidden],#attr-value input[type=radio]", |
| 337 'expect': [ |
| 338 "attr-value-input3", |
| 339 "attr-value-input4", |
| 340 "attr-value-input6", |
| 341 "attr-value-input8", |
| 342 "attr-value-input9" |
| 343 ], |
| 344 'level': 2, |
| 345 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 346 }, |
| 347 { |
| 348 'name': |
| 349 "Attribute value selector, matching attribute with value using non-ASCII
characters", |
| 350 'selector': "[data-attr-value=中文]", |
| 351 'expect': ["attr-value-div5"], |
| 352 'level': 2, |
| 353 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 354 }, |
| 355 |
| 356 // - whitespace-separated list [att~=val] |
| 357 { |
| 358 'name': |
| 359 "Attribute whitespace-separated list selector, matching class attribute
with value", |
| 360 'selector': "#attr-whitespace [class~=\"div1\"]", |
| 361 'expect': ["attr-whitespace-div1"], |
| 362 'level': 2, |
| 363 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 364 }, |
| 365 { |
| 366 'name': |
| 367 "Attribute whitespace-separated list selector, not matching class attrib
ute with empty value", |
| 368 'selector': "#attr-whitespace [class~=\"\"]", |
| 369 'expect': [] /*no matches*/, |
| 370 'level': 2, |
| 371 'testType': TEST_QSA_BASELINE |
| 372 }, |
| 373 { |
| 374 'name': |
| 375 "Attribute whitespace-separated list selector, not matching class attrib
ute with partial value", |
| 376 'selector': "[data-attr-whitespace~=\"div\"]", |
| 377 'expect': [] /*no matches*/, |
| 378 'level': 2, |
| 379 'testType': TEST_QSA_BASELINE |
| 380 }, |
| 381 { |
| 382 'name': |
| 383 "Attribute whitespace-separated list selector, matching custom data-* at
tribute with unicode escaped value", |
| 384 'selector': "[data-attr-whitespace~=\"\\0000e9\"]", |
| 385 'expect': ["attr-whitespace-div4"], |
| 386 'level': 2, |
| 387 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 388 }, |
| 389 { |
| 390 'name': |
| 391 "Attribute whitespace-separated list selector, matching custom data-* at
tribute with escaped character", |
| 392 'selector': "[data-attr-whitespace\_foo~=\"\\e9\"]", |
| 393 'expect': ["attr-whitespace-div5"], |
| 394 'level': 2, |
| 395 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 396 }, |
| 397 { |
| 398 'name': |
| 399 "Attribute whitespace-separated list selector with single-quoted value,
matching multiple links with rel attributes", |
| 400 'selector': |
| 401 "#attr-whitespace a[rel~='bookmark'], #attr-whitespace a[rel~='nofollow
']", |
| 402 'expect': [ |
| 403 "attr-whitespace-a1", |
| 404 "attr-whitespace-a2", |
| 405 "attr-whitespace-a3", |
| 406 "attr-whitespace-a5", |
| 407 "attr-whitespace-a7" |
| 408 ], |
| 409 'level': 2, |
| 410 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 411 }, |
| 412 { |
| 413 'name': |
| 414 "Attribute whitespace-separated list selector with double-quoted value,
matching multiple links with rel attributes", |
| 415 'selector': |
| 416 "#attr-whitespace a[rel~=\"bookmark\"],#attr-whitespace a[rel~='nofollow
']", |
| 417 'expect': [ |
| 418 "attr-whitespace-a1", |
| 419 "attr-whitespace-a2", |
| 420 "attr-whitespace-a3", |
| 421 "attr-whitespace-a5", |
| 422 "attr-whitespace-a7" |
| 423 ], |
| 424 'level': 2, |
| 425 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 426 }, |
| 427 { |
| 428 'name': |
| 429 "Attribute whitespace-separated list selector with unquoted value, match
ing multiple links with rel attributes", |
| 430 'selector': |
| 431 "#attr-whitespace a[rel~=bookmark], #attr-whitespace a[rel~=nofollow]
", |
| 432 'expect': [ |
| 433 "attr-whitespace-a1", |
| 434 "attr-whitespace-a2", |
| 435 "attr-whitespace-a3", |
| 436 "attr-whitespace-a5", |
| 437 "attr-whitespace-a7" |
| 438 ], |
| 439 'level': 2, |
| 440 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 441 }, |
| 442 { |
| 443 'name': |
| 444 "Attribute whitespace-separated list selector with double-quoted value,
not matching value with space", |
| 445 'selector': "#attr-whitespace a[rel~=\"book mark\"]", |
| 446 'expect': [] /* no matches */, |
| 447 'level': 2, |
| 448 'testType': TEST_QSA_BASELINE |
| 449 }, |
| 450 { |
| 451 'name': |
| 452 "Attribute whitespace-separated list selector, matching title attribute
with value using non-ASCII characters", |
| 453 'selector': "#attr-whitespace [title~=中文]", |
| 454 'expect': ["attr-whitespace-p1"], |
| 455 'level': 2, |
| 456 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 457 }, |
| 458 |
| 459 // - hyphen-separated list [att|=val] |
| 460 { |
| 461 'name': |
| 462 "Attribute hyphen-separated list selector, not matching unspecified lang
attribute", |
| 463 'selector': "#attr-hyphen-div1[lang|=\"en\"]", |
| 464 'expect': [] /*no matches*/, |
| 465 'level': 2, |
| 466 'testType': TEST_QSA_BASELINE |
| 467 }, |
| 468 { |
| 469 'name': |
| 470 "Attribute hyphen-separated list selector, matching lang attribute with
exact value", |
| 471 'selector': "#attr-hyphen-div2[lang|=\"fr\"]", |
| 472 'expect': ["attr-hyphen-div2"], |
| 473 'level': 2, |
| 474 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 475 }, |
| 476 { |
| 477 'name': |
| 478 "Attribute hyphen-separated list selector, matching lang attribute with
partial value", |
| 479 'selector': "#attr-hyphen-div3[lang|=\"en\"]", |
| 480 'expect': ["attr-hyphen-div3"], |
| 481 'level': 2, |
| 482 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 483 }, |
| 484 { |
| 485 'name': |
| 486 "Attribute hyphen-separated list selector, not matching incorrect value"
, |
| 487 'selector': "#attr-hyphen-div4[lang|=\"es-AR\"]", |
| 488 'expect': [] /*no matches*/, |
| 489 'level': 2, |
| 490 'testType': TEST_QSA_BASELINE |
| 491 }, |
| 492 |
| 493 // - substring begins-with [att^=val] (Level 3) |
| 494 { |
| 495 'name': |
| 496 "Attribute begins with selector, matching href attributes beginning with
specified substring", |
| 497 'selector': "#attr-begins a[href^=\"http://www\"]", |
| 498 'expect': ["attr-begins-a1", "attr-begins-a3"], |
| 499 'level': 3, |
| 500 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 501 }, |
| 502 { |
| 503 'name': |
| 504 "Attribute begins with selector, matching lang attributes beginning with
specified substring, ", |
| 505 'selector': "#attr-begins [lang^=\"en-\"]", |
| 506 'expect': ["attr-begins-div2", "attr-begins-div4"], |
| 507 'level': 3, |
| 508 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 509 }, |
| 510 { |
| 511 'name': |
| 512 "Attribute begins with selector, not matching class attribute not beginn
ing with specified substring", |
| 513 'selector': "#attr-begins [class^=apple]", |
| 514 'expect': [] /*no matches*/, |
| 515 'level': 3, |
| 516 'testType': TEST_QSA_ADDITIONAL |
| 517 }, |
| 518 { |
| 519 'name': |
| 520 "Attribute begins with selector with single-quoted value, matching class
attribute beginning with specified substring", |
| 521 'selector': "#attr-begins [class^=' apple']", |
| 522 'expect': ["attr-begins-p1"], |
| 523 'level': 3, |
| 524 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 525 }, |
| 526 { |
| 527 'name': |
| 528 "Attribute begins with selector with double-quoted value, matching class
attribute beginning with specified substring", |
| 529 'selector': "#attr-begins [class^=\" apple\"]", |
| 530 'expect': ["attr-begins-p1"], |
| 531 'level': 3, |
| 532 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 533 }, |
| 534 { |
| 535 'name': |
| 536 "Attribute begins with selector with unquoted value, not matching class
attribute not beginning with specified substring", |
| 537 'selector': "#attr-begins [class^= apple]", |
| 538 'expect': [] /*no matches*/, |
| 539 'level': 3, |
| 540 'testType': TEST_QSA_ADDITIONAL |
| 541 }, |
| 542 |
| 543 // - substring ends-with [att\$=val] (Level 3) |
| 544 { |
| 545 'name': |
| 546 "Attribute ends with selector, matching href attributes ending with spec
ified substring", |
| 547 'selector': "#attr-ends a[href\$=\".org\"]", |
| 548 'expect': ["attr-ends-a1", "attr-ends-a3"], |
| 549 'level': 3, |
| 550 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 551 }, |
| 552 { |
| 553 'name': |
| 554 "Attribute ends with selector, matching lang attributes ending with spec
ified substring, ", |
| 555 'selector': "#attr-ends [lang\$=\"-CH\"]", |
| 556 'expect': ["attr-ends-div2", "attr-ends-div4"], |
| 557 'level': 3, |
| 558 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 559 }, |
| 560 { |
| 561 'name': |
| 562 "Attribute ends with selector, not matching class attribute not ending w
ith specified substring", |
| 563 'selector': "#attr-ends [class\$=apple]", |
| 564 'expect': [] /*no matches*/, |
| 565 'level': 3, |
| 566 'testType': TEST_QSA_ADDITIONAL |
| 567 }, |
| 568 { |
| 569 'name': |
| 570 "Attribute ends with selector with single-quoted value, matching class a
ttribute ending with specified substring", |
| 571 'selector': "#attr-ends [class\$='apple ']", |
| 572 'expect': ["attr-ends-p1"], |
| 573 'level': 3, |
| 574 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 575 }, |
| 576 { |
| 577 'name': |
| 578 "Attribute ends with selector with double-quoted value, matching class a
ttribute ending with specified substring", |
| 579 'selector': "#attr-ends [class\$=\"apple \"]", |
| 580 'expect': ["attr-ends-p1"], |
| 581 'level': 3, |
| 582 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 583 }, |
| 584 { |
| 585 'name': |
| 586 "Attribute ends with selector with unquoted value, not matching class at
tribute not ending with specified substring", |
| 587 'selector': "#attr-ends [class\$=apple ]", |
| 588 'expect': [] /*no matches*/, |
| 589 'level': 3, |
| 590 'testType': TEST_QSA_ADDITIONAL |
| 591 }, |
| 592 |
| 593 // - substring contains [att*=val] (Level 3) |
| 594 { |
| 595 'name': |
| 596 "Attribute contains selector, matching href attributes beginning with sp
ecified substring", |
| 597 'selector': "#attr-contains a[href*=\"http://www\"]", |
| 598 'expect': ["attr-contains-a1", "attr-contains-a3"], |
| 599 'level': 3, |
| 600 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 601 }, |
| 602 { |
| 603 'name': |
| 604 "Attribute contains selector, matching href attributes ending with speci
fied substring", |
| 605 'selector': "#attr-contains a[href*=\".org\"]", |
| 606 'expect': ["attr-contains-a1", "attr-contains-a2"], |
| 607 'level': 3, |
| 608 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 609 }, |
| 610 { |
| 611 'name': |
| 612 "Attribute contains selector, matching href attributes containing specif
ied substring", |
| 613 'selector': "#attr-contains a[href*=\".example.\"]", |
| 614 'expect': ["attr-contains-a1", "attr-contains-a3"], |
| 615 'level': 3, |
| 616 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 617 }, |
| 618 { |
| 619 'name': |
| 620 "Attribute contains selector, matching lang attributes beginning with sp
ecified substring, ", |
| 621 'selector': "#attr-contains [lang*=\"en-\"]", |
| 622 'expect': ["attr-contains-div2", "attr-contains-div6"], |
| 623 'level': 3, |
| 624 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 625 }, |
| 626 { |
| 627 'name': |
| 628 "Attribute contains selector, matching lang attributes ending with speci
fied substring, ", |
| 629 'selector': "#attr-contains [lang*=\"-CH\"]", |
| 630 'expect': ["attr-contains-div3", "attr-contains-div5"], |
| 631 'level': 3, |
| 632 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 633 }, |
| 634 { |
| 635 'name': |
| 636 "Attribute contains selector with single-quoted value, matching class at
tribute beginning with specified substring", |
| 637 'selector': "#attr-contains [class*=' apple']", |
| 638 'expect': ["attr-contains-p1"], |
| 639 'level': 3, |
| 640 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 641 }, |
| 642 { |
| 643 'name': |
| 644 "Attribute contains selector with single-quoted value, matching class at
tribute ending with specified substring", |
| 645 'selector': "#attr-contains [class*='orange ']", |
| 646 'expect': ["attr-contains-p1"], |
| 647 'level': 3, |
| 648 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 649 }, |
| 650 { |
| 651 'name': |
| 652 "Attribute contains selector with single-quoted value, matching class at
tribute containing specified substring", |
| 653 'selector': "#attr-contains [class*='ple banana ora']", |
| 654 'expect': ["attr-contains-p1"], |
| 655 'level': 3, |
| 656 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 657 }, |
| 658 { |
| 659 'name': |
| 660 "Attribute contains selector with double-quoted value, matching class at
tribute beginning with specified substring", |
| 661 'selector': "#attr-contains [class*=\" apple\"]", |
| 662 'expect': ["attr-contains-p1"], |
| 663 'level': 3, |
| 664 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 665 }, |
| 666 { |
| 667 'name': |
| 668 "Attribute contains selector with double-quoted value, matching class at
tribute ending with specified substring", |
| 669 'selector': "#attr-contains [class*=\"orange \"]", |
| 670 'expect': ["attr-contains-p1"], |
| 671 'level': 3, |
| 672 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 673 }, |
| 674 { |
| 675 'name': |
| 676 "Attribute contains selector with double-quoted value, matching class at
tribute containing specified substring", |
| 677 'selector': "#attr-contains [class*=\"ple banana ora\"]", |
| 678 'expect': ["attr-contains-p1"], |
| 679 'level': 3, |
| 680 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 681 }, |
| 682 { |
| 683 'name': |
| 684 "Attribute contains selector with unquoted value, matching class attribu
te beginning with specified substring", |
| 685 'selector': "#attr-contains [class*= apple]", |
| 686 'expect': ["attr-contains-p1"], |
| 687 'level': 3, |
| 688 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 689 }, |
| 690 { |
| 691 'name': |
| 692 "Attribute contains selector with unquoted value, matching class attribu
te ending with specified substring", |
| 693 'selector': "#attr-contains [class*=orange ]", |
| 694 'expect': ["attr-contains-p1"], |
| 695 'level': 3, |
| 696 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 697 }, |
| 698 { |
| 699 'name': |
| 700 "Attribute contains selector with unquoted value, matching class attribu
te containing specified substring", |
| 701 'selector': "#attr-contains [class*= banana ]", |
| 702 'expect': ["attr-contains-p1"], |
| 703 'level': 3, |
| 704 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 705 }, |
| 706 |
| 707 // Pseudo-classes |
| 708 // - :root (Level 3) |
| 709 { |
| 710 'name': ":root pseudo-class selector, matching document root element", |
| 711 'selector': ":root", |
| 712 'expect': ["html"], |
| 713 'exclude': ["element", "fragment", "detached"], |
| 714 'level': 3, |
| 715 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 716 }, |
| 717 { |
| 718 'name': ":root pseudo-class selector, not matching document root element", |
| 719 'selector': ":root", |
| 720 'expect': [] /*no matches*/, |
| 721 'exclude': ["document"], |
| 722 'level': 3, |
| 723 'testType': TEST_QSA_ADDITIONAL |
| 724 }, |
| 725 |
| 726 // - :nth-child(n) (Level 3) |
| 727 { |
| 728 'name': ":nth-child selector, matching the third child element", |
| 729 'selector': "#pseudo-nth-table1 :nth-child(3)", |
| 730 'expect': [ |
| 731 "pseudo-nth-td3", |
| 732 "pseudo-nth-td9", |
| 733 "pseudo-nth-tr3", |
| 734 "pseudo-nth-td15" |
| 735 ], |
| 736 'level': 3, |
| 737 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 738 }, |
| 739 { |
| 740 'name': ":nth-child selector, matching every third child element", |
| 741 'selector': "#pseudo-nth li:nth-child(3n)", |
| 742 'expect': [ |
| 743 "pseudo-nth-li3", |
| 744 "pseudo-nth-li6", |
| 745 "pseudo-nth-li9", |
| 746 "pseudo-nth-li12" |
| 747 ], |
| 748 'level': 3, |
| 749 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 750 }, |
| 751 { |
| 752 'name': |
| 753 ":nth-child selector, matching every second child element, starting from
the fourth", |
| 754 'selector': "#pseudo-nth li:nth-child(2n+4)", |
| 755 'expect': [ |
| 756 "pseudo-nth-li4", |
| 757 "pseudo-nth-li6", |
| 758 "pseudo-nth-li8", |
| 759 "pseudo-nth-li10", |
| 760 "pseudo-nth-li12" |
| 761 ], |
| 762 'level': 3, |
| 763 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 764 }, |
| 765 { |
| 766 'name': |
| 767 ":nth-child selector, matching every fourth child element, starting from
the third", |
| 768 'selector': "#pseudo-nth-p1 :nth-child(4n-1)", |
| 769 'expect': ["pseudo-nth-em2", "pseudo-nth-span3"], |
| 770 'level': 3, |
| 771 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 772 }, |
| 773 |
| 774 // - :nth-last-child (Level 3) |
| 775 { |
| 776 'name': ":nth-last-child selector, matching the third last child element", |
| 777 'selector': "#pseudo-nth-table1 :nth-last-child(3)", |
| 778 'expect': [ |
| 779 "pseudo-nth-tr1", |
| 780 "pseudo-nth-td4", |
| 781 "pseudo-nth-td10", |
| 782 "pseudo-nth-td16" |
| 783 ], |
| 784 'level': 3, |
| 785 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 786 }, |
| 787 { |
| 788 'name': |
| 789 ":nth-last-child selector, matching every third child element from the e
nd", |
| 790 'selector': "#pseudo-nth li:nth-last-child(3n)", |
| 791 'expect': [ |
| 792 "pseudo-nth-li1", |
| 793 "pseudo-nth-li4", |
| 794 "pseudo-nth-li7", |
| 795 "pseudo-nth-li10" |
| 796 ], |
| 797 'level': 3, |
| 798 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 799 }, |
| 800 { |
| 801 'name': |
| 802 ":nth-last-child selector, matching every second child element from the
end, starting from the fourth last", |
| 803 'selector': "#pseudo-nth li:nth-last-child(2n+4)", |
| 804 'expect': [ |
| 805 "pseudo-nth-li1", |
| 806 "pseudo-nth-li3", |
| 807 "pseudo-nth-li5", |
| 808 "pseudo-nth-li7", |
| 809 "pseudo-nth-li9" |
| 810 ], |
| 811 'level': 3, |
| 812 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 813 }, |
| 814 { |
| 815 'name': |
| 816 ":nth-last-child selector, matching every fourth element from the end, s
tarting from the third last", |
| 817 'selector': "#pseudo-nth-p1 :nth-last-child(4n-1)", |
| 818 'expect': ["pseudo-nth-span2", "pseudo-nth-span4"], |
| 819 'level': 3, |
| 820 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 821 }, |
| 822 |
| 823 // - :nth-of-type(n) (Level 3) |
| 824 { |
| 825 'name': ":nth-of-type selector, matching the third em element", |
| 826 'selector': "#pseudo-nth-p1 em:nth-of-type(3)", |
| 827 'expect': ["pseudo-nth-em3"], |
| 828 'level': 3, |
| 829 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 830 }, |
| 831 { |
| 832 'name': |
| 833 ":nth-of-type selector, matching every second element of their type", |
| 834 'selector': "#pseudo-nth-p1 :nth-of-type(2n)", |
| 835 'expect': [ |
| 836 "pseudo-nth-em2", |
| 837 "pseudo-nth-span2", |
| 838 "pseudo-nth-span4", |
| 839 "pseudo-nth-strong2", |
| 840 "pseudo-nth-em4" |
| 841 ], |
| 842 'level': 3, |
| 843 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 844 }, |
| 845 { |
| 846 'name': |
| 847 ":nth-of-type selector, matching every second elemetn of their type, sta
rting from the first", |
| 848 'selector': "#pseudo-nth-p1 span:nth-of-type(2n-1)", |
| 849 'expect': ["pseudo-nth-span1", "pseudo-nth-span3"], |
| 850 'level': 3, |
| 851 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 852 }, |
| 853 |
| 854 // - :nth-last-of-type(n) (Level 3) |
| 855 { |
| 856 'name': ":nth-last-of-type selector, matching the thrid last em element", |
| 857 'selector': "#pseudo-nth-p1 em:nth-last-of-type(3)", |
| 858 'expect': ["pseudo-nth-em2"], |
| 859 'level': 3, |
| 860 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 861 }, |
| 862 { |
| 863 'name': |
| 864 ":nth-last-of-type selector, matching every second last element of their
type", |
| 865 'selector': "#pseudo-nth-p1 :nth-last-of-type(2n)", |
| 866 'expect': [ |
| 867 "pseudo-nth-span1", |
| 868 "pseudo-nth-em1", |
| 869 "pseudo-nth-strong1", |
| 870 "pseudo-nth-em3", |
| 871 "pseudo-nth-span3" |
| 872 ], |
| 873 'level': 3, |
| 874 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 875 }, |
| 876 { |
| 877 'name': |
| 878 ":nth-last-of-type selector, matching every second last element of their
type, starting from the last", |
| 879 'selector': "#pseudo-nth-p1 span:nth-last-of-type(2n-1)", |
| 880 'expect': ["pseudo-nth-span2", "pseudo-nth-span4"], |
| 881 'level': 3, |
| 882 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 883 }, |
| 884 |
| 885 // - :first-of-type (Level 3) |
| 886 { |
| 887 'name': ":first-of-type selector, matching the first em element", |
| 888 'selector': "#pseudo-nth-p1 em:first-of-type", |
| 889 'expect': ["pseudo-nth-em1"], |
| 890 'level': 3, |
| 891 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 892 }, |
| 893 { |
| 894 'name': |
| 895 ":first-of-type selector, matching the first of every type of element", |
| 896 'selector': "#pseudo-nth-p1 :first-of-type", |
| 897 'expect': ["pseudo-nth-span1", "pseudo-nth-em1", "pseudo-nth-strong1"], |
| 898 'level': 3, |
| 899 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 900 }, |
| 901 { |
| 902 'name': |
| 903 ":first-of-type selector, matching the first td element in each table ro
w", |
| 904 'selector': "#pseudo-nth-table1 tr :first-of-type", |
| 905 'expect': ["pseudo-nth-td1", "pseudo-nth-td7", "pseudo-nth-td13"], |
| 906 'level': 3, |
| 907 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 908 }, |
| 909 |
| 910 // - :last-of-type (Level 3) |
| 911 { |
| 912 'name': ":last-of-type selector, matching the last em elemnet", |
| 913 'selector': "#pseudo-nth-p1 em:last-of-type", |
| 914 'expect': ["pseudo-nth-em4"], |
| 915 'level': 3, |
| 916 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 917 }, |
| 918 { |
| 919 'name': |
| 920 ":last-of-type selector, matching the last of every type of element", |
| 921 'selector': "#pseudo-nth-p1 :last-of-type", |
| 922 'expect': ["pseudo-nth-span4", "pseudo-nth-strong2", "pseudo-nth-em4"], |
| 923 'level': 3, |
| 924 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 925 }, |
| 926 { |
| 927 'name': |
| 928 ":last-of-type selector, matching the last td element in each table row"
, |
| 929 'selector': "#pseudo-nth-table1 tr :last-of-type", |
| 930 'expect': ["pseudo-nth-td6", "pseudo-nth-td12", "pseudo-nth-td18"], |
| 931 'level': 3, |
| 932 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 933 }, |
| 934 |
| 935 // - :first-child |
| 936 { |
| 937 'name': |
| 938 ":first-child pseudo-class selector, matching first child div element", |
| 939 'selector': "#pseudo-first-child div:first-child", |
| 940 'expect': ["pseudo-first-child-div1"], |
| 941 'level': 2, |
| 942 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 943 }, |
| 944 { |
| 945 'name': |
| 946 ":first-child pseudo-class selector, doesn't match non-first-child eleme
nts", |
| 947 'selector': |
| 948 ".pseudo-first-child-div2:first-child, .pseudo-first-child-div3:first-ch
ild", |
| 949 'expect': [] /*no matches*/, |
| 950 'level': 2, |
| 951 'testType': TEST_QSA_BASELINE |
| 952 }, |
| 953 { |
| 954 'name': |
| 955 ":first-child pseudo-class selector, matching first-child of multiple el
ements", |
| 956 'selector': "#pseudo-first-child span:first-child", |
| 957 'expect': [ |
| 958 "pseudo-first-child-span1", |
| 959 "pseudo-first-child-span3", |
| 960 "pseudo-first-child-span5" |
| 961 ], |
| 962 'level': 2, |
| 963 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 964 }, |
| 965 |
| 966 // - :last-child (Level 3) |
| 967 { |
| 968 'name': |
| 969 ":last-child pseudo-class selector, matching last child div element", |
| 970 'selector': "#pseudo-last-child div:last-child", |
| 971 'expect': ["pseudo-last-child-div3"], |
| 972 'level': 3, |
| 973 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 974 }, |
| 975 { |
| 976 'name': |
| 977 ":last-child pseudo-class selector, doesn't match non-last-child element
s", |
| 978 'selector': |
| 979 ".pseudo-last-child-div1:last-child, .pseudo-last-child-div2:first-child
", |
| 980 'expect': [] /*no matches*/, |
| 981 'level': 3, |
| 982 'testType': TEST_QSA_ADDITIONAL |
| 983 }, |
| 984 { |
| 985 'name': |
| 986 ":last-child pseudo-class selector, matching first-child of multiple ele
ments", |
| 987 'selector': "#pseudo-last-child span:last-child", |
| 988 'expect': [ |
| 989 "pseudo-last-child-span2", |
| 990 "pseudo-last-child-span4", |
| 991 "pseudo-last-child-span6" |
| 992 ], |
| 993 'level': 3, |
| 994 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 995 }, |
| 996 |
| 997 // - :only-child (Level 3) |
| 998 { |
| 999 'name': |
| 1000 ":pseudo-only-child pseudo-class selector, matching all only-child eleme
nts", |
| 1001 'selector': "#pseudo-only :only-child", |
| 1002 'expect': ["pseudo-only-span1"], |
| 1003 'level': 3, |
| 1004 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1005 }, |
| 1006 { |
| 1007 'name': |
| 1008 ":pseudo-only-child pseudo-class selector, matching only-child em elemen
ts", |
| 1009 'selector': "#pseudo-only em:only-child", |
| 1010 'expect': [] /*no matches*/, |
| 1011 'level': 3, |
| 1012 'testType': TEST_QSA_ADDITIONAL |
| 1013 }, |
| 1014 |
| 1015 // - :only-of-type (Level 3) |
| 1016 { |
| 1017 'name': |
| 1018 ":pseudo-only-of-type pseudo-class selector, matching all elements with
no siblings of the same type", |
| 1019 'selector': "#pseudo-only :only-of-type", |
| 1020 'expect': ["pseudo-only-span1", "pseudo-only-em1"], |
| 1021 'level': 3, |
| 1022 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1023 }, |
| 1024 { |
| 1025 'name': |
| 1026 ":pseudo-only-of-type pseudo-class selector, matching em elements with n
o siblings of the same type", |
| 1027 'selector': "#pseudo-only em:only-of-type", |
| 1028 'expect': ["pseudo-only-em1"], |
| 1029 'level': 3, |
| 1030 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1031 }, |
| 1032 |
| 1033 // - :empty (Level 3) |
| 1034 { |
| 1035 'name': ":empty pseudo-class selector, matching empty p elements", |
| 1036 'selector': "#pseudo-empty p:empty", |
| 1037 'expect': ["pseudo-empty-p1", "pseudo-empty-p2"], |
| 1038 'level': 3, |
| 1039 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1040 }, |
| 1041 { |
| 1042 'name': ":empty pseudo-class selector, matching all empty elements", |
| 1043 'selector': "#pseudo-empty :empty", |
| 1044 'expect': ["pseudo-empty-p1", "pseudo-empty-p2", "pseudo-empty-span1"], |
| 1045 'level': 3, |
| 1046 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1047 }, |
| 1048 |
| 1049 // - :link and :visited |
| 1050 // Implementations may treat all visited links as unvisited, so these cannot b
e tested separately. |
| 1051 // The only guarantee is that ":link,:visited" matches the set of all visited
and unvisited links and that they are individually mutually exclusive sets. |
| 1052 { |
| 1053 'name': |
| 1054 ":link and :visited pseudo-class selectors, matching a and area elements
with href attributes", |
| 1055 'selector': "#pseudo-link :link, #pseudo-link :visited", |
| 1056 'expect': ["pseudo-link-a1", "pseudo-link-a2", "pseudo-link-area1"], |
| 1057 'level': 1, |
| 1058 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1059 }, |
| 1060 { |
| 1061 'name': |
| 1062 ":link and :visited pseudo-class selectors, matching link elements with
href attributes", |
| 1063 'selector': "#head :link, #head :visited", |
| 1064 'expect': ["pseudo-link-link1", "pseudo-link-link2"], |
| 1065 'exclude': ["element", "fragment", "detached"], |
| 1066 'level': 1, |
| 1067 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1068 }, |
| 1069 { |
| 1070 'name': |
| 1071 ":link and :visited pseudo-class selectors, not matching link elements w
ith href attributes", |
| 1072 'selector': "#head :link, #head :visited", |
| 1073 'expect': [] /*no matches*/, |
| 1074 'exclude': ["document"], |
| 1075 'level': 1, |
| 1076 'testType': TEST_QSA_BASELINE |
| 1077 }, |
| 1078 { |
| 1079 'name': |
| 1080 ":link and :visited pseudo-class selectors, chained, mutually exclusive
pseudo-classes match nothing", |
| 1081 'selector': ":link:visited", |
| 1082 'expect': [] /*no matches*/, |
| 1083 'exclude': ["document"], |
| 1084 'level': 1, |
| 1085 'testType': TEST_QSA_BASELINE |
| 1086 }, |
| 1087 |
| 1088 // - :target (Level 3) |
| 1089 { |
| 1090 'name': |
| 1091 ":target pseudo-class selector, matching the element referenced by the U
RL fragment identifier", |
| 1092 'selector': ":target", |
| 1093 'expect': [] /*no matches*/, |
| 1094 'exclude': ["document", "element"], |
| 1095 'level': 3, |
| 1096 'testType': TEST_QSA_ADDITIONAL |
| 1097 }, |
| 1098 { |
| 1099 'name': |
| 1100 ":target pseudo-class selector, matching the element referenced by the U
RL fragment identifier", |
| 1101 'selector': ":target", |
| 1102 'expect': ["target"], |
| 1103 'exclude': ["fragment", "detached"], |
| 1104 'level': 3, |
| 1105 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1106 }, |
| 1107 |
| 1108 // - :lang() |
| 1109 { |
| 1110 'name': ":lang pseudo-class selector, matching inherited language", |
| 1111 'selector': "#pseudo-lang-div1:lang(en)", |
| 1112 'expect': ["pseudo-lang-div1"], |
| 1113 'exclude': ["detached", "fragment"], |
| 1114 'level': 2, |
| 1115 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1116 }, |
| 1117 { |
| 1118 'name': |
| 1119 ":lang pseudo-class selector, not matching element with no inherited lan
guage", |
| 1120 'selector': "#pseudo-lang-div1:lang(en)", |
| 1121 'expect': [] /*no matches*/, |
| 1122 'exclude': ["document", "element"], |
| 1123 'level': 2, |
| 1124 'testType': TEST_QSA_BASELINE |
| 1125 }, |
| 1126 { |
| 1127 'name': |
| 1128 ":lang pseudo-class selector, matching specified language with exact val
ue", |
| 1129 'selector': "#pseudo-lang-div2:lang(fr)", |
| 1130 'expect': ["pseudo-lang-div2"], |
| 1131 'level': 2, |
| 1132 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1133 }, |
| 1134 { |
| 1135 'name': |
| 1136 ":lang pseudo-class selector, matching specified language with partial v
alue", |
| 1137 'selector': "#pseudo-lang-div3:lang(en)", |
| 1138 'expect': ["pseudo-lang-div3"], |
| 1139 'level': 2, |
| 1140 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1141 }, |
| 1142 { |
| 1143 'name': ":lang pseudo-class selector, not matching incorrect language", |
| 1144 'selector': "#pseudo-lang-div4:lang(es-AR)", |
| 1145 'expect': [] /*no matches*/, |
| 1146 'level': 2, |
| 1147 'testType': TEST_QSA_BASELINE |
| 1148 }, |
| 1149 |
| 1150 // - :enabled (Level 3) |
| 1151 { |
| 1152 'name': |
| 1153 ":enabled pseudo-class selector, matching all enabled form controls", |
| 1154 'selector': "#pseudo-ui :enabled", |
| 1155 'expect': [ |
| 1156 "pseudo-ui-input1", |
| 1157 "pseudo-ui-input2", |
| 1158 "pseudo-ui-input3", |
| 1159 "pseudo-ui-input4", |
| 1160 "pseudo-ui-input5", |
| 1161 "pseudo-ui-input6", |
| 1162 "pseudo-ui-input7", |
| 1163 "pseudo-ui-input8", |
| 1164 "pseudo-ui-input9", |
| 1165 "pseudo-ui-textarea1", |
| 1166 "pseudo-ui-button1" |
| 1167 ], |
| 1168 'level': 3, |
| 1169 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1170 }, |
| 1171 |
| 1172 // - :disabled (Level 3) |
| 1173 { |
| 1174 'name': |
| 1175 ":enabled pseudo-class selector, matching all disabled form controls", |
| 1176 'selector': "#pseudo-ui :disabled", |
| 1177 'expect': [ |
| 1178 "pseudo-ui-input10", |
| 1179 "pseudo-ui-input11", |
| 1180 "pseudo-ui-input12", |
| 1181 "pseudo-ui-input13", |
| 1182 "pseudo-ui-input14", |
| 1183 "pseudo-ui-input15", |
| 1184 "pseudo-ui-input16", |
| 1185 "pseudo-ui-input17", |
| 1186 "pseudo-ui-input18", |
| 1187 "pseudo-ui-textarea2", |
| 1188 "pseudo-ui-button2" |
| 1189 ], |
| 1190 'level': 3, |
| 1191 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1192 }, |
| 1193 |
| 1194 // - :checked (Level 3) |
| 1195 { |
| 1196 'name': |
| 1197 ":checked pseudo-class selector, matching checked radio buttons and chec
kboxes", |
| 1198 'selector': "#pseudo-ui :checked", |
| 1199 'expect': [ |
| 1200 "pseudo-ui-input4", |
| 1201 "pseudo-ui-input6", |
| 1202 "pseudo-ui-input13", |
| 1203 "pseudo-ui-input15" |
| 1204 ], |
| 1205 'level': 3, |
| 1206 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1207 }, |
| 1208 |
| 1209 // - :not(s) (Level 3) |
| 1210 { |
| 1211 'name': ":not pseudo-class selector, matching ", |
| 1212 'selector': "#not>:not(div)", |
| 1213 'expect': ["not-p1", "not-p2", "not-p3"], |
| 1214 'level': 3, |
| 1215 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1216 }, |
| 1217 { |
| 1218 'name': ":not pseudo-class selector, matching ", |
| 1219 'selector': "#not * :not(:first-child)", |
| 1220 'expect': ["not-em1", "not-em2", "not-em3"], |
| 1221 'level': 3, |
| 1222 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1223 }, |
| 1224 { |
| 1225 'name': ":not pseudo-class selector, matching nothing", |
| 1226 'selector': ":not(*)", |
| 1227 'expect': [] /* no matches */, |
| 1228 'level': 3, |
| 1229 'testType': TEST_QSA_ADDITIONAL |
| 1230 }, |
| 1231 { |
| 1232 'name': ":not pseudo-class selector, matching nothing", |
| 1233 'selector': ":not(*|*)", |
| 1234 'expect': [] /* no matches */, |
| 1235 'level': 3, |
| 1236 'testType': TEST_QSA_ADDITIONAL |
| 1237 }, |
| 1238 |
| 1239 // Pseudo-elements |
| 1240 // - ::first-line |
| 1241 { |
| 1242 'name': |
| 1243 ":first-line pseudo-element (one-colon syntax) selector, not matching an
y elements", |
| 1244 'selector': "#pseudo-element:first-line", |
| 1245 'expect': [] /*no matches*/, |
| 1246 'level': 2, |
| 1247 'testType': TEST_QSA_BASELINE |
| 1248 }, |
| 1249 { |
| 1250 'name': |
| 1251 "::first-line pseudo-element (two-colon syntax) selector, not matching a
ny elements", |
| 1252 'selector': "#pseudo-element::first-line", |
| 1253 'expect': [] /*no matches*/, |
| 1254 'level': 3, |
| 1255 'testType': TEST_QSA_ADDITIONAL |
| 1256 }, |
| 1257 |
| 1258 // - ::first-letter |
| 1259 { |
| 1260 'name': |
| 1261 ":first-letter pseudo-element (one-colon syntax) selector, not matching
any elements", |
| 1262 'selector': "#pseudo-element:first-letter", |
| 1263 'expect': [] /*no matches*/, |
| 1264 'level': 2, |
| 1265 'testType': TEST_QSA_BASELINE |
| 1266 }, |
| 1267 { |
| 1268 'name': |
| 1269 "::first-letter pseudo-element (two-colon syntax) selector, not matching
any elements", |
| 1270 'selector': "#pseudo-element::first-letter", |
| 1271 'expect': [] /*no matches*/, |
| 1272 'level': 3, |
| 1273 'testType': TEST_QSA_ADDITIONAL |
| 1274 }, |
| 1275 |
| 1276 // - ::before |
| 1277 { |
| 1278 'name': |
| 1279 ":before pseudo-element (one-colon syntax) selector, not matching any el
ements", |
| 1280 'selector': "#pseudo-element:before", |
| 1281 'expect': [] /*no matches*/, |
| 1282 'level': 2, |
| 1283 'testType': TEST_QSA_BASELINE |
| 1284 }, |
| 1285 { |
| 1286 'name': |
| 1287 "::before pseudo-element (two-colon syntax) selector, not matching any e
lements", |
| 1288 'selector': "#pseudo-element::before", |
| 1289 'expect': [] /*no matches*/, |
| 1290 'level': 3, |
| 1291 'testType': TEST_QSA_ADDITIONAL |
| 1292 }, |
| 1293 |
| 1294 // - ::after |
| 1295 { |
| 1296 'name': |
| 1297 ":after pseudo-element (one-colon syntax) selector, not matching any ele
ments", |
| 1298 'selector': "#pseudo-element:after", |
| 1299 'expect': [] /*no matches*/, |
| 1300 'level': 2, |
| 1301 'testType': TEST_QSA_BASELINE |
| 1302 }, |
| 1303 { |
| 1304 'name': |
| 1305 "::after pseudo-element (two-colon syntax) selector, not matching any el
ements", |
| 1306 'selector': "#pseudo-element::after", |
| 1307 'expect': [] /*no matches*/, |
| 1308 'level': 3, |
| 1309 'testType': TEST_QSA_ADDITIONAL |
| 1310 }, |
| 1311 |
| 1312 // Class Selectors |
| 1313 { |
| 1314 'name': "Class selector, matching element with specified class", |
| 1315 'selector': ".class-p", |
| 1316 'expect': ["class-p1", "class-p2", "class-p3"], |
| 1317 'level': 1, |
| 1318 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1319 }, |
| 1320 { |
| 1321 'name': |
| 1322 "Class selector, chained, matching only elements with all specified clas
ses", |
| 1323 'selector': "#class .apple.orange.banana", |
| 1324 'expect': [ |
| 1325 "class-div1", |
| 1326 "class-div2", |
| 1327 "class-p4", |
| 1328 "class-div3", |
| 1329 "class-p6", |
| 1330 "class-div4" |
| 1331 ], |
| 1332 'level': 1, |
| 1333 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1334 }, |
| 1335 { |
| 1336 'name': "Class Selector, chained, with type selector", |
| 1337 'selector': "div.apple.banana.orange", |
| 1338 'expect': ["class-div1", "class-div2", "class-div3", "class-div4"], |
| 1339 'level': 1, |
| 1340 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1341 }, |
| 1342 // Caution: If copying and pasting the folowing non-ASCII classes, ensure unic
ode normalisation is not performed in the process. |
| 1343 { |
| 1344 'name': |
| 1345 "Class selector, matching element with class value using non-ASCII chara
cters", |
| 1346 'selector': ".台北Táiběi", |
| 1347 'expect': ["class-span1"], |
| 1348 'level': 1, |
| 1349 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1350 }, |
| 1351 { |
| 1352 'name': |
| 1353 "Class selector, matching multiple elements with class value using non-A
SCII characters", |
| 1354 'selector': ".台北", |
| 1355 'expect': ["class-span1", "class-span2"], |
| 1356 'level': 1, |
| 1357 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1358 }, |
| 1359 { |
| 1360 'name': |
| 1361 "Class selector, chained, matching element with multiple class values us
ing non-ASCII characters", |
| 1362 'selector': ".台北Táiběi.台北", |
| 1363 'expect': ["class-span1"], |
| 1364 'level': 1, |
| 1365 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1366 }, |
| 1367 { |
| 1368 'name': |
| 1369 "Class selector, matching element with class with escaped character", |
| 1370 'selector': ".foo\\:bar", |
| 1371 'expect': ["class-span3"], |
| 1372 'level': 1, |
| 1373 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1374 }, |
| 1375 { |
| 1376 'name': |
| 1377 "Class selector, matching element with class with escaped character", |
| 1378 'selector': ".test\\.foo\\[5\\]bar", |
| 1379 'expect': ["class-span4"], |
| 1380 'level': 1, |
| 1381 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1382 }, |
| 1383 |
| 1384 // ID Selectors |
| 1385 { |
| 1386 'name': "ID selector, matching element with specified id", |
| 1387 'selector': "#id #id-div1", |
| 1388 'expect': ["id-div1"], |
| 1389 'level': 1, |
| 1390 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1391 }, |
| 1392 { |
| 1393 'name': "ID selector, chained, matching element with specified id", |
| 1394 'selector': "#id-div1, #id-div1", |
| 1395 'expect': ["id-div1"], |
| 1396 'level': 1, |
| 1397 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1398 }, |
| 1399 { |
| 1400 'name': "ID selector, chained, matching element with specified id", |
| 1401 'selector': "#id-div1, #id-div2", |
| 1402 'expect': ["id-div1", "id-div2"], |
| 1403 'level': 1, |
| 1404 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1405 }, |
| 1406 { |
| 1407 'name': "ID Selector, chained, with type selector", |
| 1408 'selector': "div#id-div1, div#id-div2", |
| 1409 'expect': ["id-div1", "id-div2"], |
| 1410 'level': 1, |
| 1411 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1412 }, |
| 1413 { |
| 1414 'name': "ID selector, not matching non-existent descendant", |
| 1415 'selector': "#id #none", |
| 1416 'expect': [] /*no matches*/, |
| 1417 'level': 1, |
| 1418 'testType': TEST_QSA_BASELINE |
| 1419 }, |
| 1420 { |
| 1421 'name': "ID selector, not matching non-existent ancestor", |
| 1422 'selector': "#none #id-div1", |
| 1423 'expect': [] /*no matches*/, |
| 1424 'level': 1, |
| 1425 'testType': TEST_QSA_BASELINE |
| 1426 }, |
| 1427 { |
| 1428 'name': "ID selector, matching multiple elements with duplicate id", |
| 1429 'selector': "#id-li-duplicate", |
| 1430 'expect': [ |
| 1431 "id-li-duplicate", |
| 1432 "id-li-duplicate", |
| 1433 "id-li-duplicate", |
| 1434 "id-li-duplicate" |
| 1435 ], |
| 1436 'level': 1, |
| 1437 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1438 }, |
| 1439 |
| 1440 // Caution: If copying and pasting the folowing non-ASCII IDs, ensure unicode
normalisation is not performed in the process. |
| 1441 { |
| 1442 'name': "ID selector, matching id value using non-ASCII characters", |
| 1443 'selector': "#台北Táiběi", |
| 1444 'expect': ["台北Táiběi"], |
| 1445 'level': 1, |
| 1446 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1447 }, |
| 1448 { |
| 1449 'name': "ID selector, matching id value using non-ASCII characters", |
| 1450 'selector': "#台北", |
| 1451 'expect': ["台北"], |
| 1452 'level': 1, |
| 1453 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1454 }, |
| 1455 { |
| 1456 'name': "ID selector, matching id values using non-ASCII characters", |
| 1457 'selector': "#台北Táiběi, #台北", |
| 1458 'expect': ["台北Táiběi", "台北"], |
| 1459 'level': 1, |
| 1460 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1461 }, |
| 1462 |
| 1463 // 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 |
| 1464 { |
| 1465 'name': "ID selector, matching element with id with escaped character", |
| 1466 'selector': "#\\#foo\\:bar", |
| 1467 'expect': ["#foo:bar"], |
| 1468 'level': 1, |
| 1469 'testType': TEST_QSA_BASELINE |
| 1470 }, |
| 1471 { |
| 1472 'name': "ID selector, matching element with id with escaped character", |
| 1473 'selector': "#test\\.foo\\[5\\]bar", |
| 1474 'expect': ["test.foo[5]bar"], |
| 1475 'level': 1, |
| 1476 'testType': TEST_QSA_BASELINE |
| 1477 }, |
| 1478 |
| 1479 // Namespaces |
| 1480 // XXX runMatchesTest() in level2-lib.js can't handle these because non-HTML e
lements don't have a recognised id |
| 1481 { |
| 1482 'name': "Namespace selector, matching element with any namespace", |
| 1483 'selector': "#any-namespace *|div", |
| 1484 'expect': [ |
| 1485 "any-namespace-div1", |
| 1486 "any-namespace-div2", |
| 1487 "any-namespace-div3", |
| 1488 "any-namespace-div4" |
| 1489 ], |
| 1490 'level': 3, |
| 1491 'testType': TEST_QSA_BASELINE |
| 1492 }, |
| 1493 { |
| 1494 'name': "Namespace selector, matching div elements in no namespace only", |
| 1495 'selector': "#no-namespace |div", |
| 1496 'expect': ["no-namespace-div3"], |
| 1497 'level': 3, |
| 1498 'testType': TEST_QSA_BASELINE |
| 1499 }, |
| 1500 { |
| 1501 'name': "Namespace selector, matching any elements in no namespace only", |
| 1502 'selector': "#no-namespace |*", |
| 1503 'expect': ["no-namespace-div3"], |
| 1504 'level': 3, |
| 1505 'testType': TEST_QSA_BASELINE |
| 1506 }, |
| 1507 |
| 1508 // Combinators |
| 1509 // - Descendant combinator ' ' |
| 1510 { |
| 1511 'name': |
| 1512 "Descendant combinator, matching element that is a descendant of an elem
ent with id", |
| 1513 'selector': "#descendant div", |
| 1514 'expect': [ |
| 1515 "descendant-div1", |
| 1516 "descendant-div2", |
| 1517 "descendant-div3", |
| 1518 "descendant-div4" |
| 1519 ], |
| 1520 'level': 1, |
| 1521 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1522 }, |
| 1523 { |
| 1524 'name': |
| 1525 "Descendant combinator, matching element with id that is a descendant of
an element", |
| 1526 'selector': "body #descendant-div1", |
| 1527 'expect': ["descendant-div1"], |
| 1528 'exclude': ["detached", "fragment"], |
| 1529 'level': 1, |
| 1530 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1531 }, |
| 1532 { |
| 1533 'name': |
| 1534 "Descendant combinator, matching element with id that is a descendant of
an element", |
| 1535 'selector': "div #descendant-div1", |
| 1536 'expect': ["descendant-div1"], |
| 1537 'level': 1, |
| 1538 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1539 }, |
| 1540 { |
| 1541 'name': |
| 1542 "Descendant combinator, matching element with id that is a descendant of
an element with id", |
| 1543 'selector': "#descendant #descendant-div2", |
| 1544 'expect': ["descendant-div2"], |
| 1545 'level': 1, |
| 1546 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1547 }, |
| 1548 { |
| 1549 'name': |
| 1550 "Descendant combinator, matching element with class that is a descendant
of an element with id", |
| 1551 'selector': "#descendant .descendant-div2", |
| 1552 'expect': ["descendant-div2"], |
| 1553 'level': 1, |
| 1554 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1555 }, |
| 1556 { |
| 1557 'name': |
| 1558 "Descendant combinator, matching element with class that is a descendant
of an element with class", |
| 1559 'selector': ".descendant-div1 .descendant-div3", |
| 1560 'expect': ["descendant-div3"], |
| 1561 'level': 1, |
| 1562 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1563 }, |
| 1564 { |
| 1565 'name': |
| 1566 "Descendant combinator, not matching element with id that is not a desce
ndant of an element with id", |
| 1567 'selector': "#descendant-div1 #descendant-div4", |
| 1568 'expect': [] /*no matches*/, |
| 1569 'level': 1, |
| 1570 'testType': TEST_QSA_BASELINE |
| 1571 }, |
| 1572 { |
| 1573 'name': "Descendant combinator, whitespace characters", |
| 1574 'selector': "#descendant\t\r\n#descendant-div2", |
| 1575 'expect': ["descendant-div2"], |
| 1576 'level': 1, |
| 1577 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1578 }, |
| 1579 |
| 1580 // - Child combinator '>' |
| 1581 { |
| 1582 'name': |
| 1583 "Child combinator, matching element that is a child of an element with i
d", |
| 1584 'selector': "#child>div", |
| 1585 'expect': ["child-div1", "child-div4"], |
| 1586 'level': 2, |
| 1587 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1588 }, |
| 1589 { |
| 1590 'name': |
| 1591 "Child combinator, matching element with id that is a child of an elemen
t", |
| 1592 'selector': "div>#child-div1", |
| 1593 'expect': ["child-div1"], |
| 1594 'level': 2, |
| 1595 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1596 }, |
| 1597 { |
| 1598 'name': |
| 1599 "Child combinator, matching element with id that is a child of an elemen
t with id", |
| 1600 'selector': "#child>#child-div1", |
| 1601 'expect': ["child-div1"], |
| 1602 'level': 2, |
| 1603 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1604 }, |
| 1605 { |
| 1606 'name': |
| 1607 "Child combinator, matching element with id that is a child of an elemen
t with class", |
| 1608 'selector': "#child-div1>.child-div2", |
| 1609 'expect': ["child-div2"], |
| 1610 'level': 2, |
| 1611 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1612 }, |
| 1613 { |
| 1614 'name': |
| 1615 "Child combinator, matching element with class that is a child of an ele
ment with class", |
| 1616 'selector': ".child-div1>.child-div2", |
| 1617 'expect': ["child-div2"], |
| 1618 'level': 2, |
| 1619 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1620 }, |
| 1621 { |
| 1622 'name': |
| 1623 "Child combinator, not matching element with id that is not a child of a
n element with id", |
| 1624 'selector': "#child>#child-div3", |
| 1625 'expect': [] /*no matches*/, |
| 1626 'level': 2, |
| 1627 'testType': TEST_QSA_BASELINE |
| 1628 }, |
| 1629 { |
| 1630 'name': |
| 1631 "Child combinator, not matching element with id that is not a child of a
n element with class", |
| 1632 'selector': "#child-div1>.child-div3", |
| 1633 'expect': [] /*no matches*/, |
| 1634 'level': 2, |
| 1635 'testType': TEST_QSA_BASELINE |
| 1636 }, |
| 1637 { |
| 1638 'name': |
| 1639 "Child combinator, not matching element with class that is not a child o
f an element with class", |
| 1640 'selector': ".child-div1>.child-div3", |
| 1641 'expect': [] /*no matches*/, |
| 1642 'level': 2, |
| 1643 'testType': TEST_QSA_BASELINE |
| 1644 }, |
| 1645 { |
| 1646 'name': "Child combinator, surrounded by whitespace", |
| 1647 'selector': "#child-div1\t\r\n>\t\r\n#child-div2", |
| 1648 'expect': ["child-div2"], |
| 1649 'level': 2, |
| 1650 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1651 }, |
| 1652 { |
| 1653 'name': "Child combinator, whitespace after", |
| 1654 'selector': "#child-div1>\t\r\n#child-div2", |
| 1655 'expect': ["child-div2"], |
| 1656 'level': 2, |
| 1657 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1658 }, |
| 1659 { |
| 1660 'name': "Child combinator, whitespace before", |
| 1661 'selector': "#child-div1\t\r\n>#child-div2", |
| 1662 'expect': ["child-div2"], |
| 1663 'level': 2, |
| 1664 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1665 }, |
| 1666 { |
| 1667 'name': "Child combinator, no whitespace", |
| 1668 'selector': "#child-div1>#child-div2", |
| 1669 'expect': ["child-div2"], |
| 1670 'level': 2, |
| 1671 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1672 }, |
| 1673 |
| 1674 // - Adjacent sibling combinator '+' |
| 1675 { |
| 1676 'name': |
| 1677 "Adjacent sibling combinator, matching element that is an adjacent sibli
ng of an element with id", |
| 1678 'selector': "#adjacent-div2+div", |
| 1679 'expect': ["adjacent-div4"], |
| 1680 'level': 2, |
| 1681 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1682 }, |
| 1683 { |
| 1684 'name': |
| 1685 "Adjacent sibling combinator, matching element with id that is an adjace
nt sibling of an element", |
| 1686 'selector': "div+#adjacent-div4", |
| 1687 'expect': ["adjacent-div4"], |
| 1688 'level': 2, |
| 1689 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1690 }, |
| 1691 { |
| 1692 'name': |
| 1693 "Adjacent sibling combinator, matching element with id that is an adjace
nt sibling of an element with id", |
| 1694 'selector': "#adjacent-div2+#adjacent-div4", |
| 1695 'expect': ["adjacent-div4"], |
| 1696 'level': 2, |
| 1697 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1698 }, |
| 1699 { |
| 1700 'name': |
| 1701 "Adjacent sibling combinator, matching element with class that is an adj
acent sibling of an element with id", |
| 1702 'selector': "#adjacent-div2+.adjacent-div4", |
| 1703 'expect': ["adjacent-div4"], |
| 1704 'level': 2, |
| 1705 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1706 }, |
| 1707 { |
| 1708 'name': |
| 1709 "Adjacent sibling combinator, matching element with class that is an adj
acent sibling of an element with class", |
| 1710 'selector': ".adjacent-div2+.adjacent-div4", |
| 1711 'expect': ["adjacent-div4"], |
| 1712 'level': 2, |
| 1713 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1714 }, |
| 1715 { |
| 1716 'name': |
| 1717 "Adjacent sibling combinator, matching p element that is an adjacent sib
ling of a div element", |
| 1718 'selector': "#adjacent div+p", |
| 1719 'expect': ["adjacent-p2"], |
| 1720 'level': 2, |
| 1721 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1722 }, |
| 1723 { |
| 1724 'name': |
| 1725 "Adjacent sibling combinator, not matching element with id that is not a
n adjacent sibling of an element with id", |
| 1726 'selector': "#adjacent-div2+#adjacent-p2, #adjacent-div2+#adjacent-div1", |
| 1727 'expect': [] /*no matches*/, |
| 1728 'level': 2, |
| 1729 'testType': TEST_QSA_BASELINE |
| 1730 }, |
| 1731 { |
| 1732 'name': "Adjacent sibling combinator, surrounded by whitespace", |
| 1733 'selector': "#adjacent-p2\t\r\n+\t\r\n#adjacent-p3", |
| 1734 'expect': ["adjacent-p3"], |
| 1735 'level': 2, |
| 1736 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1737 }, |
| 1738 { |
| 1739 'name': "Adjacent sibling combinator, whitespace after", |
| 1740 'selector': "#adjacent-p2+\t\r\n#adjacent-p3", |
| 1741 'expect': ["adjacent-p3"], |
| 1742 'level': 2, |
| 1743 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1744 }, |
| 1745 { |
| 1746 'name': "Adjacent sibling combinator, whitespace before", |
| 1747 'selector': "#adjacent-p2\t\r\n+#adjacent-p3", |
| 1748 'expect': ["adjacent-p3"], |
| 1749 'level': 2, |
| 1750 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1751 }, |
| 1752 { |
| 1753 'name': "Adjacent sibling combinator, no whitespace", |
| 1754 'selector': "#adjacent-p2+#adjacent-p3", |
| 1755 'expect': ["adjacent-p3"], |
| 1756 'level': 2, |
| 1757 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1758 }, |
| 1759 |
| 1760 // - General sibling combinator ~ (Level 3) |
| 1761 { |
| 1762 'name': |
| 1763 "General sibling combinator, matching element that is a sibling of an el
ement with id", |
| 1764 'selector': "#sibling-div2~div", |
| 1765 'expect': ["sibling-div4", "sibling-div6"], |
| 1766 'level': 3, |
| 1767 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1768 }, |
| 1769 { |
| 1770 'name': |
| 1771 "General sibling combinator, matching element with id that is a sibling
of an element", |
| 1772 'selector': "div~#sibling-div4", |
| 1773 'expect': ["sibling-div4"], |
| 1774 'level': 3, |
| 1775 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1776 }, |
| 1777 { |
| 1778 'name': |
| 1779 "General sibling combinator, matching element with id that is a sibling
of an element with id", |
| 1780 'selector': "#sibling-div2~#sibling-div4", |
| 1781 'expect': ["sibling-div4"], |
| 1782 'level': 3, |
| 1783 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1784 }, |
| 1785 { |
| 1786 'name': |
| 1787 "General sibling combinator, matching element with class that is a sibli
ng of an element with id", |
| 1788 'selector': "#sibling-div2~.sibling-div", |
| 1789 'expect': ["sibling-div4", "sibling-div6"], |
| 1790 'level': 3, |
| 1791 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1792 }, |
| 1793 { |
| 1794 'name': |
| 1795 "General sibling combinator, matching p element that is a sibling of a d
iv element", |
| 1796 'selector': "#sibling div~p", |
| 1797 'expect': ["sibling-p2", "sibling-p3"], |
| 1798 'level': 3, |
| 1799 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1800 }, |
| 1801 { |
| 1802 'name': |
| 1803 "General sibling combinator, not matching element with id that is not a
sibling after a p element", |
| 1804 'selector': "#sibling>p~div", |
| 1805 'expect': [] /*no matches*/, |
| 1806 'level': 3, |
| 1807 'testType': TEST_QSA_ADDITIONAL |
| 1808 }, |
| 1809 { |
| 1810 'name': |
| 1811 "General sibling combinator, not matching element with id that is not a
sibling after an element with id", |
| 1812 'selector': "#sibling-div2~#sibling-div3, #sibling-div2~#sibling-div1", |
| 1813 'expect': [] /*no matches*/, |
| 1814 'level': 3, |
| 1815 'testType': TEST_QSA_ADDITIONAL |
| 1816 }, |
| 1817 { |
| 1818 'name': "General sibling combinator, surrounded by whitespace", |
| 1819 'selector': "#sibling-p2\t\r\n~\t\r\n#sibling-p3", |
| 1820 'expect': ["sibling-p3"], |
| 1821 'level': 3, |
| 1822 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1823 }, |
| 1824 { |
| 1825 'name': "General sibling combinator, whitespace after", |
| 1826 'selector': "#sibling-p2~\t\r\n#sibling-p3", |
| 1827 'expect': ["sibling-p3"], |
| 1828 'level': 3, |
| 1829 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1830 }, |
| 1831 { |
| 1832 'name': "General sibling combinator, whitespace before", |
| 1833 'selector': "#sibling-p2\t\r\n~#sibling-p3", |
| 1834 'expect': ["sibling-p3"], |
| 1835 'level': 3, |
| 1836 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1837 }, |
| 1838 { |
| 1839 'name': "General sibling combinator, no whitespace", |
| 1840 'selector': "#sibling-p2~#sibling-p3", |
| 1841 'expect': ["sibling-p3"], |
| 1842 'level': 3, |
| 1843 'testType': TEST_QSA_ADDITIONAL | TEST_MATCH_BASELINE |
| 1844 }, |
| 1845 |
| 1846 // Group of selectors (comma) |
| 1847 { |
| 1848 'name': "Syntax, group of selectors separator, surrounded by whitespace", |
| 1849 'selector': "#group em\t\r \n,\t\r \n#group strong", |
| 1850 'expect': ["group-em1", "group-strong1"], |
| 1851 'level': 1, |
| 1852 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1853 }, |
| 1854 { |
| 1855 'name': "Syntax, group of selectors separator, whitespace after", |
| 1856 'selector': "#group em,\t\r\n#group strong", |
| 1857 'expect': ["group-em1", "group-strong1"], |
| 1858 'level': 1, |
| 1859 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1860 }, |
| 1861 { |
| 1862 'name': "Syntax, group of selectors separator, whitespace before", |
| 1863 'selector': "#group em\t\r\n,#group strong", |
| 1864 'expect': ["group-em1", "group-strong1"], |
| 1865 'level': 1, |
| 1866 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1867 }, |
| 1868 { |
| 1869 'name': "Syntax, group of selectors separator, no whitespace", |
| 1870 'selector': "#group em,#group strong", |
| 1871 'expect': ["group-em1", "group-strong1"], |
| 1872 'level': 1, |
| 1873 'testType': TEST_QSA_BASELINE | TEST_MATCH_BASELINE |
| 1874 }, |
| 1875 ]; |
OLD | NEW |