Automattic\WooCommerce\Vendor\Pelago\Emogrifier\HtmlProcessor
AbstractHtmlProcessor::ensurePhpUnrecognizedSelfClosingTagsAreXml
Makes sure that any self-closing tags not recognized as such by PHP's DOMDocument implementation have a self-closing slash.
Method of the class: AbstractHtmlProcessor{}
No Hooks.
Returns
String. HTML with problematic tags converted.
Usage
// private - for code of main (parent) class only $result = $this->ensurePhpUnrecognizedSelfClosingTagsAreXml( $html ): string;
- $html(string) (required)
- .
AbstractHtmlProcessor::ensurePhpUnrecognizedSelfClosingTagsAreXml() AbstractHtmlProcessor::ensurePhpUnrecognizedSelfClosingTagsAreXml code WC 10.4.3
private function ensurePhpUnrecognizedSelfClosingTagsAreXml(string $html): string
{
return (new Preg())->replace(
'%<' . self::PHP_UNRECOGNIZED_VOID_TAGNAME_MATCHER . '\\b[^>]*+(?<!/)(?=>)%',
'$0/',
$html
);
}