Closed tinynow closed 7 years ago
fix on line 57:
else if (cs.boxSizing == "content-box") {
- offset = -element.clientHeight;
+ offset = -element.clientHeight + parseFloat(cs.minHeight);
}
(pull request inc... soon)
For textareas with min-height set, I had to change line 60 as follows to not have extra offset:
(stretchy.js - line 60)
if (offset > parseFloat(cs.minHeight)) {
element.style.height = element.scrollHeight + offset + "px";
} else {
element.style.height = element.scrollHeight + "px";
}
do I understand correctly that this conditional is essentially checking whether cs.boxSizing
is "content-box"? could you make a simple codepen of the issue?
seems to work fine with the latest code: http://codepen.io/anfedorov/pen/xqWPja
no?
My default CSS style is set with box-sizing: border-box;
If I change it to box-sizing: content-box
, then the code works as you show.
(But would require changing my CSS)
got it. opened #28.
The change is much simpler than I did with the conditional.
My new change is in ~line 55:
if (cs.boxSizing == "border-box") {
offset = 0; // element.offsetHeight;
}
This is for Safari on Mac desktop. I have not yet tested other browsers.
Update: Changing the offset = 10, instead of 0 (for 'border-box') gets rid of the scrollbar in Firefox (Mac).
makes sense. let's discuss on #28. sounds like some automated cross-browser tests would be of some help here, as well...
Here is an example of the bug: http://codepen.io/tinynow/pen/MyXZNL