Automattic\WooCommerce\Vendor\Pelago\Emogrifier\HtmlProcessor
AbstractHtmlProcessor::normalizeDocumentType
Makes sure the document type in the passed HTML has lowercase "html".
Method of the class: AbstractHtmlProcessor{}
No Hooks.
Returns
String. HTML with normalized document type
Usage
// private - for code of main (parent) class only $result = $this->normalizeDocumentType( $html ): string;
- $html(string) (required)
- .
AbstractHtmlProcessor::normalizeDocumentType() AbstractHtmlProcessor::normalizeDocumentType code WC 10.8.1
private function normalizeDocumentType(string $html): string
{
// Limit to replacing the first occurrence: as an optimization; and in case an example exists as unescaped text.
return (new Preg())->replace(
'/<!DOCTYPE\\s++html(?=[\\s>])/i',
'<!DOCTYPE html',
$html,
1
);
}