Skip to content

Commit

Permalink
fixed reflowing of initial text for Chrome and Safari.
Browse files Browse the repository at this point in the history
  • Loading branch information
jackmoore committed Sep 26, 2015
1 parent 7b64e33 commit 8729783
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/autosize.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ function assign(ta, {setOverflowX = true, setOverflowY = true} = {}) {
if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || set.has(ta)) return;

let heightOffset = null;
let overflowY = 'hidden';
let overflowY = null;
let clientWidth = ta.clientWidth;

function init() {
const style = window.getComputedStyle(ta, null);

overflowY = style.overflowY;

if (style.resize === 'vertical') {
ta.style.resize = 'none';
} else if (style.resize === 'both') {
Expand Down Expand Up @@ -153,9 +155,6 @@ function assign(ta, {setOverflowX = true, setOverflowY = true} = {}) {
ta.addEventListener('autosize:update', update);
set.add(ta);

if (setOverflowY) {
ta.style.overflowY = 'hidden';
}
if (setOverflowX) {
ta.style.overflowX = 'hidden';
ta.style.wordWrap = 'break-word';
Expand Down

0 comments on commit 8729783

Please sign in to comment.