Pseudo-class and Pseudo-element Reference for QueryPath
The CSS 3 Selector specification defines pseudo-classes and pseudo-elements. QueryPath implements as many of these as is possible.
This is a draft reference that will probably be included in QueryPath 2.0. Read on to view the entire document. <!--break-->
Supported Pseudo-classesThere are three categories of supported pseudo-classes: Those from the CSS 3 Selector specification, those that are QueryPath-specific, and those that are defined in jQuery, and thus defined here for compatibility.
- link (HTML only)
- nth-of-type (as of QuerPath 'quark')
- nth-last-of-type (as of QuerPath 'quark')
- not: this can take a FULL CSS 3 selector, not just a simple selector.
Non-standard (QueryPath-specific) pseudo-classes
Non-standard pseudo-classes (from jQuery)
- even: like nth-child(even)
- odd: like nth-child(odd)
- lt: index of element is less than given value
- gt: index of element is greater than given value
- nth: index of element is equal to given value
- eq: index of element is equal to given value (see :nth)
- first: first element beneath the parent
- last: last element beneath the parent
- parent: parent of the selected element(s)
- enabled: element (typically a form element) that is enabled
- disabled: element (typically a form element) that is disabled
- checked: element whose state is checked (usually form radios and checkboxes)
- text: element that is a text field
- radio: element that is a radio button
- checkbox: element that is a checkbox
- file: element that is a file upload
- password: element that is a password field
- submit: element that is a submit button
- image: element that is an image button.
- reset: element is a reset button
- button: element that is a button
- header: element is an HTML header (h1+).
- has: given a sub-selection (sub-query), return elements who have children that match the sub-query
- contains: elements that have text that matches that passed as the value to
Important: QueryPath requires that pseudo-elements begin with a double-colon (
::) and does not retain a single-colon (
:) comptability option, since it does not need to retain backward compatibility with CSS 2.1 implementations.
The CSS specification indicates that these should operate on text as render by the user agent (UA). However, since there is no visual UA in QueryPath, they operate more directly on the text.
- first-line: Will return the text before the first line feed (
Some CSS pseudo-classes can not be implemented because they require a user-facing user agent. QueryPath is not designed for this.
Unsupported standard pseudo-classes
Unsupported jQuery pseudo-classes
::after pseudo-elements have nothing to select in QueryPath (there is no UA-generated content.) The
::selection pseudo-element does not apply when there is no UA.