CssToInlineStyles
CssToInlineStyles copied to clipboard
Adds doctypes when not needed/requested
$cssToInlineStyles = new \TijsVerkoyen\CssToInlineStyles\CssToInlineStyles();
$css = '.hi { font-style: bold; }';
$html = '<table class="hi"></table>';
echo $cssToInlineStyles->convert($html, $css);
Actual:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><table class="hi" style="font-style: bold;"></table></body></html>
Expected:
<table style="font-style: bold;"></table>
Potential fix, could add:
LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD
to LoadHTML in
createDomDocumentFromHtml
for users who don't want it.
I'll extend the class in the meantime.