QueryPath\CSS\DOMTraverser::combineAdjacent PHP 메소드

combineAdjacent() 공개 메소드

The spec does not indicate whether Adjacent should ignore non-Element nodes, so we choose to ignore them.
public combineAdjacent ( DOMNode $node, array $selectors, integer $index ) : boolean
$node DOMNode A DOM Node.
$selectors array The selectors array.
$index integer The current index to the operative simple selector in the selectors array.
리턴 boolean TRUE if the combination matches, FALSE otherwise.
    public function combineAdjacent($node, $selectors, $index)
    {
        while (!empty($node->previousSibling)) {
            $node = $node->previousSibling;
            if ($node->nodeType == XML_ELEMENT_NODE) {
                //$this->debug(sprintf('Testing %s against "%s"', $node->tagName, $selectors[$index]));
                return $this->matchesSimpleSelector($node, $selectors, $index);
            }
        }
        return false;
    }