Pseudo-classes and Pseudo-elements
Reference for pseudo-classes and pseudo-elements supported in QueryPath
Table of Contents
About the QueryPath CSS Reference
The CSS 3 Selector specification defines pseudo-classes and pseudo-elements. QueryPath implements as many of these as is possible.
For details on CSS 3 selectors, the canonical resource is the specification, currently in final draft form at http://www.w3.org/TR/2009/WD-css3-selectors-20090310/.
Supported Pseudo-classes and Pseudo-elements
There are three categories of supported pseudo-classes: Those from the CSS 3 Selector specification, those that are QueryPath-specific, and those that were defined in jQuery, and thus supported here for compatibility.
Supported standard pseudo-classes
- :lang(en-us) -- language code, matches lang or xml:lang attributes.
- :link() -- HTML only
- :root()
- :nth-child(an + b)
- :nth-last-child(an + b)
- :nth-of-type(an + b) -- as of QuerPath 'quark'
- :nth-last-of-type(an + b) -- as of QuerPath 'quark'
- :first-child
- :last-child
- :first-of-type
- :last-of-type
- :only-child
- :only-of-type
- :empty
- :not(filter) -- this can take a FULL CSS 3 selector, not just a simple selector.
Supported QueryPath-specific pseudo-classes
Supported non-standard jQuery pseudo-classes
- :even -- like nth-child(even)
- :odd -- like nth-child(odd)
- :lt(int) -- index of element is less than given value
- :gt(int) -- index of element is greater than given value
- :nth(int) -- index of element is equal to given value
- :eq(int) -- synonym for :nth()
- :first -- element is first child of some parent
- :last -- element is last child of some parent
- :parent -- element has at least one child
- :enabled -- element is enabled form element (HTML only)
- :disabled -- element is disabled form element (HTML only)
- :checked -- element is checked, likely a form field (HTML only)
- :text -- element is text field (HTML only)
- :radio -- element is radio button (HTML only)
- :checkbox -- element is checkbox (HTML only)
- :file -- element is file upload field (HTML only)
- :password -- element is password field (HTML only)
- :submit -- element is submit button (HTML only)
- :image
- :button -- element is button (HTML only)
- :reset -- element is reset button (HTML only)
- :header -- elements that are HTML headers (h1 - hN)
- :has(some filter) -- elements that have children that match the supplied filter
- :contains(some text) -- elements that have text which matches the supplied value
Supported pseudo-elements
pseudo-elements use the double-colon (::) notation.
No other notation is supported in QueryPath. (Other CSS 3
implementations may support single-colon syntax of CSS 2.1.
QueryPath does not.)
- ::first-letter
- ::first-line -- calculated by seeking for the first explicit line ending (\n).
Unsupported Pseudo-classes and Pseudo-elements
Several pseudo-classes and pseudo-elements require a visual user agent (UA)
before they can be used. QueryPath does not provide a visual representation
of XML or HTML data, and thus cannot implement these pseudo-classes and
pseudo-elements.
- :visited
- :hover
- :active
- :focus
- :target
- :indeterminate
- :animated (jQuery extension)
- :visible (jQuery extension)
- :hidden (jQuery extension)
- ::before
- ::after
- ::selected