src/Template/Tokenizer/Token/Element.php
private function parseForeignContents(string $tag, string $html): string
    {
        $remainingHtml = \ltrim($html);

        // Find all contents.
        $remainingHtml = $this->determineRemainingHtmlOfForeignContents(
            $tag,
            $html,
            $remainingHtml
        );

        // Handle no contents.
        if ($this->value === '') {
            return $remainingHtml;
        }

        if ($tag === 'script') {
            $text = new TextJs($this, $this->value);
        } elseif ($tag === 'style') {
            $text = new TextCss($this, $this->value);
        } else {
            $text = new Text($this, $this->value);
        }

        $this->children[] = $text;

        return $remainingHtml;
    }
private function parseForeignContents(string $tag, string $html): string
    {
        $remainingHtml = \ltrim($html);

        // Find all contents.
        $remainingHtml = $this->determineRemainingHtmlOfForeignContents(
            $tag,
            $html,
            $remainingHtml
        );

        // Handle no contents.
        if ($this->value === '') {
            return $remainingHtml;
        }

        if ($tag === 'script') {
            $text = new TextJs($this, $this->value);
        } elseif ($tag === 'style') {
            $text = new TextCss($this, $this->value);
        } else {
            $text = new Text($this, $this->value);
        }

        $this->children[] = $text;

        return $remainingHtml;
    }
private function parseForeignContents ( string $ tag , string $ html ) : string { $ remainingHtml = \ ltrim ( $ html ) ; // Find all contents. $ remainingHtml = $ this -> determineRemainingHtmlOfForeignContents ( $ tag , $ html , $ remainingHtml ) ; // Handle no contents. if ( $ this -> value === '' ) { return $ remainingHtml ; } if ( $ tag === 'script' ) { $ text = new TextJs ( $ this , $ this -> value ) ; } elseif ( $ tag === 'style' ) { $ text = new TextCss ( $ this , $ this -> value ) ; } else { $ text = new Text ( $ this , $ this -> value ) ; } $ this -> children [ ] = $ text ; return $ remainingHtml ; }
Will parse the script and style contents correctly.

@param $tag  string
@param $html string

@return string The remaining HTML.
Will parse the script and style contents correctly .