Merge pull request #508 from thelounge/PR/optimize-textarea

Slight optimization in the textarea code
This commit is contained in:
Jérémie Astori 2016-07-16 22:46:06 -04:00 committed by GitHub
commit 9d547315f7

View File

@ -632,6 +632,8 @@ $(function() {
.history() .history()
.on("input keyup", function() { .on("input keyup", function() {
var style = window.getComputedStyle(this); var style = window.getComputedStyle(this);
var origHeight = this.style.height;
this.style.height = "0px"; this.style.height = "0px";
this.offsetHeight; // force reflow this.offsetHeight; // force reflow
this.style.height = Math.min( this.style.height = Math.min(
@ -641,7 +643,9 @@ $(function() {
+ Math.round(parseFloat(style.borderBottomWidth) || 0) + Math.round(parseFloat(style.borderBottomWidth) || 0)
) + "px"; ) + "px";
if (this.style.height !== origHeight) {
$("#chat .chan.active .chat").trigger("msg.sticky"); // fix growing $("#chat .chan.active .chat").trigger("msg.sticky"); // fix growing
}
}) })
.tab(complete, {hint: false}); .tab(complete, {hint: false});