Section 5: Selectors

Design notes

These tests follow the order of the specifications. The words Valid and Invalid mean that the relevant CSS will and won't validate, respectively. The word Interact means that the user should interact with the page in order to view the result. In the following tests, the red color indicates failure while the green color indicates that the test has been passed by the browser. The label Assertion explains the scope of the test.

Download

You can download all these tests in a single zip file.

Summary of tests
Name Title Flag Assertion
adjacent0.html Selectors: Adjacent selectors Valid Browsers should apply each rule to the adjacent element
adjacent1.html Adjacent selectors without the space separator Valid Browsers should apply each rule to the adjacent element also without the space separator
adjacent2.html Adjacent selectors with the universal selector Valid Browsers should apply each rule to the adjacent element when combined with the universal selector
attribute0.html Attribute selectors: Generic match Valid Browsers should apply each rule to the elements with the specified attribute, disregarding its value
attribute1.html Attribute selectors: Generic match with the universal selector Valid Browsers should apply each rule to the elements with the specified attribute, disregarding its value
attribute2.html Attribute selectors: Exact match Valid Browsers should apply each rule to the elements with the specified attribute and the specified value
attribute3.html Attribute selectors: Exact match with the universal selector Valid Browsers should apply each rule to the elements with the specified attribute and the specified value
attribute4.html Attribute selectors: Partial match Valid Browsers should apply each rule to the elements with one of the values separated by a space
attribute5.html Attribute selectors: Partial match with the universal selector Valid Browsers should apply each rule to the elements with one of the values separated by a space
attribute6.html Attribute selectors: Substring matching Valid Browsers should apply each rule to the elements which have an hyphen-separated list of attribute values
attribute7.html Attribute selectors: Substring matching with the universal selector Valid Browsers should apply each rule to the elements which have an hyphen-separated list of attribute values
before-after0.html The :before and :after pseudo-elements Valid Browsers should insert content before and after the content of the specified element
childselector0.html Child selectors Valid Browsers should apply each rule to the child elements
childselector1.html Child selectors without the space separator Valid Browsers should apply each rule to the child elements, even when they are not separed by a space
childselector2.html Child selectors and universal selector Valid Browsers should apply each rule to the child elements, even when combined with an universal selector
class0.html Class selectors Valid Browsers should apply each rule to the elements which have the specified class
class1.html Class selectors with the universal selector Valid Browsers should apply each rule to the elements which have the specified class
class2.html Class selectors: Multiple classes Valid Browsers should apply each rule to the elements which have the specified class or classes
descendantselector0.html Descendant selectors Valid Browsers should apply each rule to the descendant elements
descendantselector1.html Descendant selectors and universal selector Valid Browsers should apply each rule to the descendant elements
dinamicpseudoclasses0.html The dynamic pseudo-classes: :hover on links Valid Interact Browsers should honour the change of state in the elements
dinamicpseudoclasses1.html The dynamic pseudo-classes: :hover on different elements Valid Interact Browsers should honour the change of state in the elements
dinamicpseudoclasses2.html The dynamic pseudo-classes: :active Valid Interact Browsers should honour the change of state in the elements
dinamicpseudoclasses3.html The dynamic pseudo-classes: :focus Valid Interact Browsers should honour the change of state in the elements
first-child0.html The :first-child pseudo-class Valid Browsers should apply each rule to the element which is the first child of its parent
first-child1.html The :first-child pseudo-class with the universal selector Valid Browsers should apply each rule to the element which is the first child of its parent
first-letter0.html The :first-letter pseudo-element Valid Browsers should apply the rule only to the first letter of a block-level element
first-line0.html The :first-line pseudo-element Valid Browsers should apply the rule only to the first line of a block-level element
grouping0.html Grouping Valid Browsers should apply the rule to all elements grouped
grouping1.html Grouping: Invalid grouping Invalid Browsers should ignore an invalid grouping
id0.html ID selectors Valid Browsers should apply each rule to the elements which have the specified ID
id1.html ID selectors with universal selector Valid Browsers should apply each rule to the elements which have the specified ID
lang0.html The language pseudo-class: :lang Valid Browsers should apply the rule when has a lang attribute set in a particular language
link-visited0.html The link pseudo-classes: :link and :visited Valid Interact Browsers should honour the change of state in the links
link-visited1.html The link pseudo-classes: :link and :visited and the universal selector Valid Interact Browsers should honour the change of state in the links
pseudo-elements0.html Invalid combination of pseudo-elements Invalid Browsers should ignore a trailing token
typeselector0.html Type selectors Valid Browsers should apply each rule to the specified elements
universalselector0.html Universal selector Valid Browsers should apply the rule to all elements

Date: December 2, 2007