posthtml-inline-css
posthtml-inline-css copied to clipboard
Invalid HTML tree support
With corrected HTML trees, inline transformations can use correct CSS selectors. Bad HTML templates are common from designers:
<style>
a { color:yellow }
table a { color:red }
</style>
<table>
<a href="#">link</a>
<tr><td></td></tr>
</table>
would otherwise become:
<table>
<a href="#" style="color:red">link</a>
<tr><td></td></tr>
</table>
instead of:
<a href="#" style="color:yellow">link</a>
<table>
<tr><td></td></tr>
</table>
This could be solved by recommending the user to use a [currently theoretical] posthtml-parse5 parser plugin, instead of trying to correct a tree parsed with the default htmlparser2.