You are here

public static function Html::normalize in Service Container 7.2

Same name and namespace in other branches
  1. 7 lib/Drupal/Component/Utility/Html.php \Drupal\Component\Utility\Html::normalize()

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

lib/Drupal/Component/Utility/Html.php, line 236
Contains \Drupal\Component\Utility\Html.

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);
}