$dom
$dom :
Handler that tracks progress of a query through a DOM.
The main idea is that we keep a copy of the tree, and then use an array to keep track of matches. To handle a list of selectors (using the comma separator), we have to track both the currently progressing match and the previously matched elements.
To use this handler:
find(string $filter) : \QueryPath\CSS\QueryPathEventHandler
Generic finding method.
This is the primary searching method used throughout QueryPath.
string | $filter | A valid CSS 3 filter. |
Returns itself.
matches() : array
Get the results of a find() operation.
Return an array of matching items.
An array of matched values. The specific data type in the matches will differ depending on the data type searched, but in the core QueryPath implementation, this will be an array of DOMNode objects.
pseudoClass( $name, $value = NULL)
This also supports the following nonstandard pseudo classes: - :x-reset/:x-root (reset to the main item passed into the constructor. Less drastic than :root) - :odd/:even (shorthand for :nth-child(odd)/:nth-child(even))
Example: :name(value)
$name | ||
$value |
adjacent()
For an element to be adjacent to another, it must be THE NEXT NODE in the node list. So if an element is surrounded by pcdata, there are no adjacent nodes. E.g. in <a/>FOO<b/>, the a and b elements are not adjacent.
In a strict DOM parser, line breaks and empty spaces are nodes. That means
nodes like this will not be adjacent:
$doc = new DomDocument();
$doc->loadXML('
parseAnB( $rule) : Array
Parse an an+b rule for CSS pseudo-classes.
$rule | Some rule in the an+b format. |
If the rule does not follow conventions.
(list($aVal, $bVal)) of the two values.
None found |
nthChild(integer $groupSize, integer $elementInGroup, boolean $lastChild = FALSE)
Pseudo-class handler for nth-child and all related pseudo-classes.
integer | $groupSize | The size of the group (in an+b, this is a). |
integer | $elementInGroup | The offset in a group. (in an+b this is b). |
boolean | $lastChild | Whether counting should begin with the last child. By default, this is false. Pseudo-classes that start with the last-child can set this to true. |
None found |
nthLastChild( $groupSize, $elementInGroup)
Pseudo-class handler for :nth-last-child and related pseudo-classes.
$groupSize | ||
$elementInGroup |
None found |
nthOfTypeChild( $groupSize, $elementInGroup, $lastChild)
Pseudo-class handler for nth-of-type-child.
Not implemented.
$groupSize | ||
$elementInGroup | ||
$lastChild |
None found |
nthLastOfTypeChild( $groupSize, $elementInGroup)
Pseudo-class handler for nth-last-of-type-child.
Not implemented.
$groupSize | ||
$elementInGroup |
None found |
not(string $filter)
Pseudo-class handler for :not(filter).
This does not follow the specification in the following way: The CSS 3 selector spec says the value of not() must be a simple selector. This function allows complex selectors.
string | $filter | A CSS selector. |
None found |
attrValMatches( $needle, $haystack, $operation)
Check for attr value matches based on an operation.
$needle | ||
$haystack | ||
$operation |
None found |
None found |
getByPosition( $operator, $pos)
Pseudo-class handler for a variety of jQuery pseudo-classes.
Handles lt, gt, eq, nth, first, last pseudo-classes.
$operator | ||
$pos |
None found |
candidateList()
Determine what candidates are in the current scope.
This is a utility method that gets the list of elements that should be evaluated in the context. If $this->findAnyElement is TRUE, this will return a list of every element that appears in the subtree of $this->matches. Otherwise, it will just return $this->matches.
None found |
getAllCandidates( $elements) : \QueryPath\CSS\A
Get a list of all of the candidate elements.
This is used when $this->findAnyElement is TRUE.
$elements | A list of current elements (usually $this->matches). |
list of all candidate elements.
None found |