Skip to content

Commit

Permalink
Fixed a potential issue introduced in 1.17.4 that causes an 'NS_ERROR…
Browse files Browse the repository at this point in the history
…_FAILURE' error in Firefox (fixes jackmoore#100).
  • Loading branch information
jackmoore committed Aug 24, 2013
1 parent 1a14525 commit d15d534
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion autosize.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "autosize",
"title": "Autosize",
"description": "Automatically adjust textarea height based on user input.",
"version": "1.17.5",
"version": "1.17.6",
"dependencies": {
"jquery": ">=1.7"
},
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jquery-autosize",
"description": "Automatically adjust textarea height based on user input.",
"version": "1.17.5",
"version": "1.17.6",
"dependencies": {
"jquery": ">=1.7"
},
Expand Down
15 changes: 5 additions & 10 deletions jquery.autosize.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
Autosize v1.17.5 - 2013-08-22
Autosize v1.17.6 - 2013-08-24
Automatically adjust textarea height based on user input.
(c) 2013 Jack Moore - http://www.jacklmoore.com/autosize
license: http://www.opensource.org/licenses/mit-license.php
Expand Down Expand Up @@ -133,15 +133,10 @@

setWidth();

// This code block fixes a Chrome-specific issue:
// The textarea overflow is probably now hidden, but Chrome doesn't reflow the text to account for the
// new space made available by removing the scrollbars. This workaround causes Chrome to reflow the text.
if ('oninput' in ta && 'setSelectionRange' in ta) {
// The following line ensures that the mirror's width change has been applied with a repaint.
// FireFox may not have repainted the width change yet, which would cause this block to run slowly
// for large blocks of text.
var firefoxFix = mirror.offsetWidth;

// Chrome-specific fix:
// When the textarea y-overflow is hidden, Chrome doesn't reflow the text to account for the space
// made available by removing the scrollbar. This workaround triggers the reflow for Chrome.
if (window.chrome && 'setSelectionRange' in ta) {
var cursorIndex = ta.selectionStart;
ta.value += ' ';
ta.value = ta.value.slice(0,-1);
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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jquery-autosize",
"description": "Automatically adjust textarea height based on user input.",
"version": "1.17.5",
"version": "1.17.6",
"dependencies": {},
"keywords": [
"form",
Expand Down
5 changes: 4 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ Small jQuery plugin to allow dynamic resizing of textarea height, so that it gro

## Changelog

### v1.17.6 - 2013/8/24
* Fixed a potential issue introduced in 1.17.4 that causes an 'NS_ERROR_FAILURE' error in Firefox.

### v1.17.5 - 2013/8/23
* Fixed oversight in previous commit that caused FireFox fix not to be applied.
* Fixed oversight in 1.17.4 that caused FireFox fix not to be applied.

### v1.17.4 - 2013/8/22
* Improved speed of editing large blocks of text in FireFox.
Expand Down

0 comments on commit d15d534

Please sign in to comment.