Skip to content

Commit

Permalink
Fix Content Security Policy (CSP) warnings about unsafe-inline styles.
Browse files Browse the repository at this point in the history
…Fixes jackmoore#199.
  • Loading branch information
jackmoore committed Feb 24, 2015
1 parent a997bb4 commit c702b51
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions jquery.autosize.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
Autosize 1.18.17
Autosize 1.18.18
license: MIT
http://www.jacklmoore.com/autosize
*/
Expand All @@ -14,9 +14,6 @@
placeholder: true
},

// border:0 is unnecessary, but avoids a bug in Firefox on OSX
copy = '<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>',

// line-height is conditionally included because IE7/IE8/old Opera do not return the correct value.
typographyStyles = [
'fontFamily',
Expand All @@ -34,7 +31,10 @@
mirrored,

// the mirror element, which is used to calculate what size the mirrored element should be.
mirror = $(copy).data('autosize', true)[0];
mirror = $('<textarea tabindex="-1"/>').data('autosize', true)[0];

// border:0 is unnecessary, but avoids a bug in Firefox on OSX
mirror.style.cssText = "position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;";

// test that line-height can be accurately copied.
mirror.style.lineHeight = '99px';
Expand Down
4 changes: 2 additions & 2 deletions jquery.autosize.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Small jQuery plugin to allow dynamic resizing of textarea height, so that it gro

## Changelog

##### v.1.18.18 - 2015/02/24
* Fix Content Security Policy (CSP) warnings about unsafe-inline styles. Fixes #199.

##### v.1.18.17 - 2014/12/10
* Fixed potential issue when using transforms to scale a textarea. Fixes #190.

Expand Down

0 comments on commit c702b51

Please sign in to comment.