pQuery\DomNode::setOuterText PHP 메소드

setOuterText() 공개 메소드

Similar to JavaScript outerText, will replace node (and child nodes) with new text
public setOuterText ( string $text, HtmlParserBase $parser = null ) : boolean | array
$text string
$parser HtmlParserBase Null to auto create instance
리턴 boolean | array True on succeed, array with errors on failure
    function setOuterText($text, $parser = null)
    {
        if (trim($text)) {
            $index = $this->index();
            if ($parser === null) {
                $parser = new $this->parserClass();
            }
            $parser->setDoc($text);
            $parser->parse_all();
            $parser->root->moveChildren($this->parent, $index);
        }
        $this->delete();
        return $parser && $parser->errors ? $parser->errors : true;
    }
DomNode