andrewrk / juice

Juice inlines CSS stylesheets into your HTML source.
MIT License
60 stars 13 forks source link

Add option applyWidthAttributes to API #9

Closed jrit closed 10 years ago

jrit commented 10 years ago

This addresses the issue where some mail clients, like Outlook, require there to be a width attribute defined on images in order to set a width other than the natural width. The change is setup so that an option has been added applyWidthAttributes and when set to true (the default is false to maintain backward compatibility) the width attribute on elements of types in the new juice.widthElements array (default is [TABLE, TD, IMG]) are set to any pixel width CSS values applied to those elements.

This change removes the need to set widths in CSS and again in HTML for some elements, so code is DRYer and behaves closer to browser CSS.

I don't believe this change to be breaking, a new test has been added and all preexisting tests pass without changes.

andrewrk commented 10 years ago

Thanks again. published in 1.2.0