CssToInlineStyles icon indicating copy to clipboard operation
CssToInlineStyles copied to clipboard

Adds doctypes when not needed/requested

Open awderh opened this issue 4 years ago • 1 comments

$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>

awderh avatar Oct 05 '20 05:10 awderh

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.

awderh avatar Oct 05 '20 05:10 awderh