0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Cache selector in afterRender function

- cache selector in a variable to prevent recomputing it in the function.
This commit is contained in:
buddhamagnet 2013-10-14 20:56:20 +01:00
parent 2a459b508a
commit 0662817cea

View file

@ -408,14 +408,16 @@
afterRender: function () {
var self = this;
Countable.live(document.getElementById('user-bio'), function (counter) {
var bioContainer = self.$('.bio-container .word-count');
if (counter.all > 180) {
self.$('.bio-container .word-count').css({color: "#e25440"});
bioContainer.css({color: "#e25440"});
} else {
self.$('.bio-container .word-count').css({color: "#9E9D95"});
bioContainer.css({color: "#9E9D95"});
}
self.$('.bio-container .word-count').text(200 - counter.all);
bioContainer.text(200 - counter.all);
});