diff --git a/README.markdown b/README.markdown index 33d14c0..421abed 100644 --- a/README.markdown +++ b/README.markdown @@ -8,7 +8,7 @@ A jQuery plugin that auto-expands textareas to fit the contents as a user types. The expandable plugin has 5 settings: * `duration` - The speed of the animation when expanding (or shrinking). Default is 'normal'. -* `init` - If true, the textarea will be resized to fit its content on initialization. +* `init` - If true, the textarea will be resized to fit its content on initialization. * `interval` - The interval at which it checks the textarea. Default is 750. * `within` - The number of rows left before expanding. Default is 1. * `by` - The number of rows to expand by. Default is 2. @@ -22,4 +22,4 @@ Copyright (c) 2010 [Brandon Aaron](http://brandonaaron.net) ## Contributors -Karl Swedberg \ No newline at end of file +Karl Swedberg diff --git a/jquery.expandable.js b/jquery.expandable.js index 8e43cdb..3c38d0c 100644 --- a/jquery.expandable.js +++ b/jquery.expandable.js @@ -18,7 +18,7 @@ $.fn.extend({ by: 2, init: false }, givenOptions); - + return this.filter('textarea').each(function() { var $this = $(this).css({ display: 'block', overflow: 'hidden' }), minHeight = $this.height(), @@ -29,12 +29,12 @@ $.fn.extend({ // white-space rules from: http://petesbloggerama.blogspot.com/2007/02/firefox-ie-word-wrap-word-break-tables.html $mirror = $('
').appendTo('body'), interval; - + // copy styles from textarea to mirror to mirror the textarea as best possible $.each('borderTopWidth borderRightWidth borderBottomWidth borderLeftWidth paddingTop paddingRight paddingBottom paddingLeft fontSize fontFamily fontWeight fontStyle fontStretch fontVariant wordSpacing lineHeight width'.split(' '), function(i,prop) { $mirror.css(prop, $this.css(prop)); }); - + // setup events $this .bind('keypress', function(event) { if ( event.keyCode == '13' ) check(); }) @@ -49,12 +49,12 @@ $.fn.extend({ // encode any html passed in and replace new lines with a