src/Helper/Parser.php
public static function removeChildNodes(Crawler $crawler): Crawler
    {
        if (!$crawler->count()) {
            return $crawler;
        }
        $crawler->children()->each(
            function (Crawler $crawler) {
                $node = $crawler->getNode(0);
                if ($node === null || $node->nodeType === 3 || \in_array($node->nodeName, self::ALLOWED_NODES, true)) {
                    return;
                }
                $node->parentNode->removeChild($node);
            }
        );

        return $crawler;
    }
public static function removeChildNodes(Crawler $crawler): Crawler
    {
        if (!$crawler->count()) {
            return $crawler;
        }
        $crawler->children()->each(
            function (Crawler $crawler) {
                $node = $crawler->getNode(0);
                if ($node === null || $node->nodeType === 3 || \in_array($node->nodeName, self::ALLOWED_NODES, true)) {
                    return;
                }
                $node->parentNode->removeChild($node);
            }
        );

        return $crawler;
    }
public static function removeChildNodes ( Crawler $ crawler ) : Crawler { if ( ! $ crawler -> count ( ) ) { return $ crawler ; } $ crawler -> children ( ) -> each ( function ( Crawler $ crawler ) { $ node = $ crawler -> getNode ( 0 ) ; if ( $ node === null || $ node -> nodeType === 3 || \ in_array ( $ node -> nodeName , self :: ALLOWED_NODES , true ) ) { return ; } $ node -> parentNode -> removeChild ( $ node ) ; } ) ; return $ crawler ; }
Removes all html elements so the text is left over

@param Crawler $crawler

@return Crawler
@throws \InvalidArgumentException
Removes all html elements so the text is left over