public function matchesSimpleSelector($node, $selectors, $index)
{
$selector = $selectors[$index];
// Note that this will short circuit as soon as one of these
// returns FALSE.
$result = $this->matchElement($node, $selector->element, $selector->ns) && $this->matchAttributes($node, $selector->attributes) && $this->matchId($node, $selector->id) && $this->matchClasses($node, $selector->classes) && $this->matchPseudoClasses($node, $selector->pseudoClasses) && $this->matchPseudoElements($node, $selector->pseudoElements);
$isNextRule = isset($selectors[++$index]);
// If there is another selector, we process that if there a match
// hasn't been found.
/*
if ($isNextRule && $selectors[$index]->combinator == SimpleSelector::anotherSelector) {
// We may need to re-initialize the match set for the next selector.
if (!$this->initialized) {
$this->initialMatch($selectors[$index]);
}
if (!$result) fprintf(STDOUT, "Element: %s, Next selector: %s\n", $node->tagName, $selectors[$index]);
return $result || $this->matchesSimpleSelector($node, $selectors, $index);
}
// If we have a match and we have a combinator, we need to
// recurse up the tree.
else*/
if ($isNextRule && $result) {
$result = $this->combine($node, $selectors, $index);
}
return $result;
}