PERF: eliminate reflow on topic render

This commit is contained in:
Sam 2014-06-01 20:53:14 +10:00
parent 46ec6e671a
commit 68600f1dce

View File

@ -37,10 +37,13 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
return;
}
this._topicProgress = $topicProgress;
// CAREFUL WITH THIS AXE
// offsetWidth will cause a reflow
this._progressWidth = $topicProgress[0].offsetWidth;
}
// speeds up stuff, bypass jquery slowness and extra checks
var totalWidth = $topicProgress[0].offsetWidth,
var totalWidth = this._progressWidth,
progressWidth = this.get('controller.streamPercentage') * totalWidth;
$topicProgress.find('.bg')