diff options
author | Jack Moore <hello@jacklmoore.com> | 2015-02-24 03:09:29 -0500 |
---|---|---|
committer | Jack Moore <hello@jacklmoore.com> | 2015-02-24 03:09:29 -0500 |
commit | c702b51bf4ef130f60a46a85b65eb99f8d7360ab (patch) | |
tree | 56d41ac2578e909afdf85414affca112af221fe4 /jquery.autosize.js | |
parent | a997bb4f1f216b5d93b73d6149b438a1ec6ce7e8 (diff) | |
download | autosize-c702b51bf4ef130f60a46a85b65eb99f8d7360ab.zip autosize-c702b51bf4ef130f60a46a85b65eb99f8d7360ab.tar.gz autosize-c702b51bf4ef130f60a46a85b65eb99f8d7360ab.tar.bz2 |
Fix Content Security Policy (CSP) warnings about unsafe-inline styles. Fixes #199.
Diffstat (limited to 'jquery.autosize.js')
-rw-r--r-- | jquery.autosize.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/jquery.autosize.js b/jquery.autosize.js index d84ce5e..4e96699 100644 --- a/jquery.autosize.js +++ b/jquery.autosize.js @@ -1,5 +1,5 @@ /*! - Autosize 1.18.17 + Autosize 1.18.18 license: MIT http://www.jacklmoore.com/autosize */ @@ -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', @@ -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'; |