public function remove($selector=null)
    {
        $result = $this;
        if ($selector) {
            $result = $result->filter($selector);
        }
        foreach ($result->nodes as $node) {
            if ($node->parentNode) {
                $node->parentNode->removeChild($node);
            }
        }

        $result->nodes = array();
        $result->length = 0;

        return $result;
    }
public function remove($selector=null)
    {
        $result = $this;
        if ($selector) {
            $result = $result->filter($selector);
        }
        foreach ($result->nodes as $node) {
            if ($node->parentNode) {
                $node->parentNode->removeChild($node);
            }
        }

        $result->nodes = array();
        $result->length = 0;

        return $result;
    }
public function remove ( $ selector = null ) { $ result = $ this ; if ( $ selector ) { $ result = $ result -> filter ( $ selector ) ; } foreach ( $ result -> nodes as $ node ) { if ( $ node -> parentNode ) { $ node -> parentNode -> removeChild ( $ node ) ; } } $ result -> nodes = array ( ) ; $ result -> length = 0 ; return $ result ; }
Remove the set of matched elements

@param string|self|callable|\DOMNodeList|\DOMNode|null $selector expression that
filters the set of matched elements to be removed

@return self
Remove the set of matched elements