-
Notifications
You must be signed in to change notification settings - Fork 247
selectors
Osmosis depends on libxmljs for parsing documents and finding elements, however libxmljs only supports XPath selectors. Although XPath selectors have much more functionality than CSS selectors, they aren't as easy to read or write.
In order for Osmosis to support both CSS and XPath selectors, it has to convert CSS selectors into XPath selectors. Converting CSS selectors to XPath is beneficial because it allows Osmosis to supplement CSS functionality as well as support CSS selectors with XPath expressions in them.
These CSS helper selectors are provided to simplify complex CSS expressions and to add jQuery-like functionality. Unlike normal pseudo-classes, these selectors can be chained any number of times in any order.
Select first element (shortcut for :first-of-type
)
Select first n
elements
Select last element (shortcut for :last-of-type
)
Select last n
elements
Skip first n
elements
Skip last n
elements
Select n1
through n2
elements inclusive
Select even elements
Select odd elements
Select nodes with checked
or selected
attributes
Select elements that have at least one selector
child
Select elements that appear before selector
Select siblings that appear before selector
Select elements whose contents contain string
Select elements whose contents start with string
Select elements whose contents end with string
Select nodes with internal or external hrefs
or src
Select nodes with a certain protocol
Select nodes with a certain domain
Select nodes that start with a certain path
Get element innerHTML
Get element outerHTML
Select comments
Select n
th element (shortcut for :nth-of-type
)
Select attribute