tiff / wysihtml5

Open source rich text editor based on HTML5 and the progressive-enhancement approach. Uses a sophisticated security concept and aims to generate fully valid HTML5 markup by preventing unmaintainable tag soups and inline styles.
http://xing.github.com/wysihtml5/
MIT License
6.49k stars 1k forks source link

Wysihtml5 Iframe width is set too large - possibly due to border box styles being ignored #470

Open atomgiant opened 10 years ago

atomgiant commented 10 years ago

In some cases, I noticed the wysihtml5 iframe was setting the width too wide so it was causing the iframe to expand outside of it's containing div. This was only happening for Chrome and FireFox. Safari did not have this issue.

I tracked it down to the shouldIgnoreBoxSizingBorderBox method:

https://github.com/xing/wysihtml5/blob/master/src/dom/copy_styles.js#L31

In the breaking cases this method was returning true which caused an explicit width but this did not take into account padding and borders. As a workaround, I modified shouldIgnoreBoxSizingBorderBox to always return false and this fixed the issue in FireFox and Chrome and Safari still renders correctly.

The bug referenced in the code also has a status of Resolved so perhaps this is not needed?

https://bugzilla.mozilla.org/show_bug.cgi?id=520992

Thanks, Tom