summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Moore <hello@jacklmoore.com>2015-04-14 16:00:01 -0400
committerJack Moore <hello@jacklmoore.com>2015-04-14 16:00:01 -0400
commitb8718445e83f7caa8014a636c81268cd94324b8b (patch)
tree041f8fcd00f76801ec710264a07c06610620a8b6
parent78a1b26f204e08f5d5c649a52c027b8e62578e54 (diff)
downloadautosize-b8718445e83f7caa8014a636c81268cd94324b8b.zip
autosize-b8718445e83f7caa8014a636c81268cd94324b8b.tar.gz
autosize-b8718445e83f7caa8014a636c81268cd94324b8b.tar.bz2
cleanup. removed lines that set wordWrap and overflow style property values, as these are no longer needed as of v2.0.
-rw-r--r--src/autosize.js32
1 files changed, 11 insertions, 21 deletions
diff --git a/src/autosize.js b/src/autosize.js
index f776beb..70c81bf 100644
--- a/src/autosize.js
+++ b/src/autosize.js
@@ -29,9 +29,6 @@
ta.style.resize = 'horizontal';
}
- // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
- ta.style.wordWrap = 'break-word';
-
// Chrome/Safari-specific fix:
// When the textarea y-overflow is hidden, Chrome/Safari doesn't reflow the text to account for the space
// made available by removing the scrollbar. This workaround will cause the text to reflow.
@@ -85,41 +82,34 @@
}
}
- // IE9 does not fire onpropertychange or oninput for deletions,
- // so binding to onkeyup to catch most of those events.
- // There is no way that I know of to detect something like 'cut' in IE9.
- if ('onpropertychange' in ta && 'oninput' in ta) {
- ta.addEventListener('keyup', adjust);
- }
-
- window.addEventListener('resize', adjust);
- ta.addEventListener('input', adjust);
-
- ta.addEventListener('autosize.update', adjust);
-
ta.addEventListener('autosize.destroy', function(style){
window.removeEventListener('resize', adjust);
ta.removeEventListener('input', adjust);
ta.removeEventListener('keyup', adjust);
+ ta.removeAttribute('data-autosize-on');
ta.removeEventListener('autosize.destroy');
Object.keys(style).forEach(function(key){
ta.style[key] = style[key];
});
-
- ta.removeAttribute('data-autosize-on');
}.bind(ta, {
height: ta.style.height,
- overflow: ta.style.overflow,
overflowY: ta.style.overflowY,
- wordWrap: ta.style.wordWrap,
resize: ta.style.resize
}));
+ // IE9 does not fire onpropertychange or oninput for deletions,
+ // so binding to onkeyup to catch most of those events.
+ // There is no way that I know of to detect something like 'cut' in IE9.
+ if ('onpropertychange' in ta && 'oninput' in ta) {
+ ta.addEventListener('keyup', adjust);
+ }
+
+ window.addEventListener('resize', adjust);
+ ta.addEventListener('input', adjust);
+ ta.addEventListener('autosize.update', adjust);
ta.setAttribute('data-autosize-on', true);
- ta.style.overflow = 'hidden';
ta.style.overflowY = 'hidden';
-
init();
}