Html::normalize

public static Html::normalize($html)

Normalizes an HTML snippet.

This function is essentially \DOMDocument::normalizeDocument(), but operates on an HTML string instead of a \DOMDocument.

Parameters

string $html: The HTML string to normalize.

Return value

string The normalized HTML string.

File

core/lib/Drupal/Component/Utility/Html.php, line 250

Class

Html
Provides DOMDocument helpers for parsing and serializing HTML strings.

Namespace

Drupal\Component\Utility

Code

public static function normalize($html) {
  $document = static::load($html);
  return static::serialize($document);
}
doc_Drupal
2016-10-29 09:18:44
Comments
Leave a Comment

Please login to continue.