Vendor/PHPHtmlParser/paquettg/php-html-parser/src/PHPHtmlParser/Dom/AbstractNode.php
public function ancestorByTag($tag)
    {
        // Start by including ourselves in the comparison.
        $node = $this;

        while ( ! is_null($node)) {
            if ($node->tag->name() == $tag) {
                return $node;
            }

            $node = $node->getParent();
        }

        throw new ParentNotFoundException('Could not find an ancestor with "'.$tag.'" tag');
    }
public function ancestorByTag($tag)
    {
        // Start by including ourselves in the comparison.
        $node = $this;

        while ( ! is_null($node)) {
            if ($node->tag->name() == $tag) {
                return $node;
            }

            $node = $node->getParent();
        }

        throw new ParentNotFoundException('Could not find an ancestor with "'.$tag.'" tag');
    }
public function ancestorByTag ( $ tag ) { // Start by including ourselves in the comparison. $ node = $ this ; while ( ! is_null ( $ node ) ) { if ( $ node -> tag -> name ( ) == $ tag ) { return $ node ; } $ node = $ node -> getParent ( ) ; } throw new ParentNotFoundException ( 'Could not find an ancestor with "' . $ tag . '" tag' ) ; }
Function to locate a specific ancestor tag in the path to the root.

@param  string $tag
@return AbstractNode
@throws ParentNotFoundException
Function to locate a specific ancestor tag in the path to the root .