Html::escapeCdataElement

public static function Html::escapeCdataElement

public static Html::escapeCdataElement(\DOMNode $node, $comment_start = '//', $comment_end = '')

Adds comments around a <!CDATA section in a \DOMNode.

\DOMDocument::loadHTML() in \Drupal\Component\Utility\Html::load() makes CDATA sections from the contents of inline script and style tags. This can cause HTML4 browsers to throw exceptions.

This function attempts to solve the problem by creating a \DOMDocumentFragment to comment the CDATA tag.

Parameters

\DOMNode $node: The element potentially containing a CDATA node.

string $comment_start登录查看完整内容