Cheat Sheet
A quick reference table for comparing W3C Selectors with the SQL-like syntax used in Jelly SQL.
SQL | CSS | Description | W3C Specification | Variants |
---|---|---|---|---|
TAG('E') | E | An element of type E | Type Selector | ELEMENT = 'E' || TAG = 'E' |
ATTR('foo') | [foo] | An element with a "foo" attribute | Attribute Selectors | ATTRIBUTE('foo') || ATTR = 'foo' || ATTRIBUTE = 'foo' |
ATTR('foo') = 'bar' | [foo="bar"] | An element whose "foo" attribute value is exactly equal to "bar" | Attribute Selectors | ATTRIBUTE('foo') = 'bar' |
ATTR('foo') = 'bar' | [foo="bar"] | An element whose "foo" attribute value is exactly equal to "bar" | Attribute Selectors | ATTRIBUTE('foo') = 'bar' |
ATTR('foo') CONTAINS 'bar' | [foo~="bar"] | An element whose "foo" attribute value is a list of whitespace-separated values, one of which is exactly equal to "bar" | Attribute Selectors | ATTRIBUTE('foo') CONTAINS 'bar' |
ATTR('foo') LIKE 'bar%' | [foo^="bar"] | An element whose "foo" attribute value begins exactly with the string "bar" | Attribute Selectors | ATTRIBUTE('foo') LIKE '%bar' |
ATTR('foo') LIKE '%bar' | [foo$="bar"] | An element whose "foo" attribute value ends exactly with the string "bar" | Attribute Selectors | ATTRIBUTE('foo') LIKE 'bar%' |
ATTR('foo') LIKE 'bar' | [foo*="bar"] | An element whose "foo" attribute value contains the substring "bar" | Attribute Selectors | ATTRIBUTE('foo') LIKE 'bar' || ATTR('foo') LIKE '%bar%' |
CHILD(ROOT) | :root | An element, root of the document | Structural Pseudo-Classes | |
CHILD(2N+1) | :nth-child(n) | An element, the n-th child of its parent | Structural Pseudo-Classes | CHILD(FIRST, 2N+1) |
CHILD(LAST, 2N+1) | :nth-last-child(n) | An element, the n-th child of its parent, counting from the last one | Structural Pseudo-Classes | |
CHILD(2N+1) AS TYPEOF | :nth-of-type(n) | An element, the n-th sibling of its type | Structural Pseudo-Classes | CHILD(FIRST, 2N+1) AS TYPEOF |
CHILD(LAST, 2N+1) AS TYPEOF | :nth-last-of-type(n) | An element, the n-th sibling of its type, counting from the last one | Structural Pseudo-Classes | |
CHILD() | :first-child | An element, first child of its parent | Structural Pseudo-Classes | CHILD(FIRST) |
CHILD(LAST) | :last-child | An element, last child of its parent | Structural Pseudo-Classes | |
CHILD() AS TYPEOF | :first-of-type | An element, first sibling of its type | Structural Pseudo-Classes | CHILD(FIRST) AS TYPEOF |
CHILD(LAST) AS TYPEOF | :last-of-type | An element, last sibling of its type | Structural Pseudo-Classes | |
CHILD(ONLY) | :only-child | An element, only child of its parent | Structural Pseudo-Classes | |
CHILD(ONLY) AS TYPEOF | :only-of-type | An element, only sibling of its type | Structural Pseudo-Classes | |
CHILD(EMPTY) | :empty | An element that has no children (including text nodes) | Structural Pseudo-Classes | |
TYPEOF(LINK) | :link | An element being the source anchor of a hyperlink of which the target is not yet visited | Link Pseudo-Classes | |
TYPEOF(VISITED) | :visited | An element being the source anchor of a hyperlink of which the target is already visited | Link Pseudo-Classes | |
TYPEOF(ACTIVE) | :active | An element during certain user actions | User Action Pseudo-Classes | |
TYPEOF(HOVER) | :hover | An element during certain user actions | User Action Pseudo-Classes | |
TYPEOF(FOCUS) | :focus | An element during certain user actions | User Action Pseudo-Classes | |
TYPEOF(TARGET) | :target | An element being the target of the referring URI | Target Pseudo-Classes | |
LANG('fr') | :lang(fr) | An element in the language "fr" (the document language specifies how language is determined) | Language Pseudo-Classes | LANGUAGE('fr') |
TYPEOF(ENABLED) | :enabled | A user interface element which is enable | UI Element States Pseudo-Classes | |
TYPEOF(DISABLED) | :disabled | A user interface element which is disabled | UI Element States Pseudo-Classes | |
TYPEOF(CHECKED) | :checked | A user interface element which is checked (for instance a radio-button or checkbox) | UI Element States Pseudo-Classes | |
TYPEOF(FIRSTLINE) | ::first-line | The first formatted line | First Line Pseudo-Element | |
TYPEOF(FIRSTLETTER) | ::first-letter | The first formatted letter | First Letter Pseudo-Element | |
TYPEOF(BEFORE) | ::before | Generated content before an element | Before Pseudo-Element | |
TYPEOF(AFTER) | ::after | Generated content after an element | After Pseudo-Element | |
CLASS = 'warning' | .warning | An element whose class is "warning" (the document language specifies how class is determined) | Class Selectors | |
ID = 'myid' | #myid | An element with ID equal to "myid" | ID Selectors | |
NOT | :not(s) | An element that does not match simple selector s | Negation Pseudo-Class | NOT LIKE || NOT EQUALS || <> || != |
TAG('F') WITHIN TAG('E') | E F | An F element descendant of an E element | Descendant Combinator | |
TAG('F') CHILD OF TAG('E') | E > F | An F element child of an E element | Child Combinator | |
TAG('F') NEXT TO TAG('E') | E + F | An F element immediately preceded by an E element | Next-Sibling Combinator | |
TAG('F') SIBLING OF TAG('E') | E ~ F | An F element preceded by an E element | Subsequent-Sibling Combinator |