Goetas\Twital\EventSubscriber\ContextAwareEscapingSubscriber::esapeScript PHP Method

esapeScript() private method

private esapeScript ( DOMDocument $doc, DOMXPath $xp )
$doc DOMDocument
$xp DOMXPath
    private function esapeScript(\DOMDocument $doc, \DOMXPath $xp)
    {
        /**
         * @var \DOMNode[] $res
         */
        $res = $this->xpathQuery($xp, "//xh:script[not(@type) or @type = 'text/javascript'][contains(., '{$this->options['tag_variable'][0]}') and contains(., '{$this->options['tag_variable'][1]}')]", $doc, false);
        foreach ($res as $node) {
            $node->insertBefore($doc->createTextnode("{$this->options['tag_block'][0]} autoescape 'js' {$this->options['tag_block'][1]}"), $node->firstChild);
            $node->appendChild($doc->createTextnode("{$this->options['tag_block'][0]} endautoescape {$this->options['tag_block'][1]}"));
        }
    }