tijsverkoyen / CssToInlineStyles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very usefull when you're sending emails.
BSD 3-Clause "New" or "Revised" License
5.8k stars 187 forks source link

Save as html instead of xml. Fixes self-closing tags and utf-8 encoding. #154

Closed josh18 closed 8 years ago

josh18 commented 8 years ago

This solves the issues with self-closing tags (<br> going to <br></br>) and assists with utf-8 encoding.

@techi602 I think this should solve all the utf-8 encoding issues?

techi602 commented 8 years ago
josh18 commented 8 years ago

@techi602 Good point, I've added in both of your tests (they both passed).

techi602 commented 8 years ago

:+1:

FilipNovy commented 8 years ago

@tijsverkoyen Please, please merge this & release new version ASAP. This is nifty component but this
makes problems in emails. Thank you!!

c960657 commented 8 years ago

@josh18 Why is the HTML5 doctype converted to lowercase? <!doctype html> and <!DOCTYPE html> equally valid, and I don't know of any compatibility problems with either.

See also http://stackoverflow.com/questions/7020961/uppercase-or-lowercase-doctype

josh18 commented 8 years ago

You are right, either is fine. If I remember correctly DOMDocument always converts it to uppercase so I converted it to lowercase so that it matches the user put in lowercase. Of course this means it won't match if the user starts with uppercase but it seems like lowercase is more of the "standard" for html5, for example HTML5Boilerplate.