src/dom/Dom.php
private static function _getNodePath($node)
    {
        $ret = array();
        $doc = $node->ownerDocument;
        $parentNode = $node->parentNode;

        while ($parentNode !== null && !$doc->isSameNode($parentNode)) {
            // gets the sibling position
            $pos = 0;
            foreach ($parentNode->childNodes as $i => $childNode) {
                if ($childNode->isSameNode($node)) {
                    $pos = $i;
                    break;
                }
            }

            array_unshift($ret, $pos);
            $node = $parentNode;
            $parentNode = $node->parentNode;
        }

        return $ret;
    }
private static function _getNodePath($node)
    {
        $ret = array();
        $doc = $node->ownerDocument;
        $parentNode = $node->parentNode;

        while ($parentNode !== null && !$doc->isSameNode($parentNode)) {
            // gets the sibling position
            $pos = 0;
            foreach ($parentNode->childNodes as $i => $childNode) {
                if ($childNode->isSameNode($node)) {
                    $pos = $i;
                    break;
                }
            }

            array_unshift($ret, $pos);
            $node = $parentNode;
            $parentNode = $node->parentNode;
        }

        return $ret;
    }
private static function _getNodePath ( $ node ) { $ ret = array ( ) ; $ doc = $ node -> ownerDocument ; $ parentNode = $ node -> parentNode ; while ( $ parentNode !== null && ! $ doc -> isSameNode ( $ parentNode ) ) { // gets the sibling position $ pos = 0 ; foreach ( $ parentNode -> childNodes as $ i => $ childNode ) { if ( $ childNode -> isSameNode ( $ node ) ) { $ pos = $ i ; break ; } } array_unshift ( $ ret , $ pos ) ; $ node = $ parentNode ; $ parentNode = $ node -> parentNode ; } return $ ret ; }
Gets the node path.

@param DOMNode $node Node

@return integer[]
Gets the node path .