From 08b0daff46e8806072777062d948bddb6f2b822a Mon Sep 17 00:00:00 2001 From: Jack Mahoney Date: Thu, 13 Feb 2014 11:49:37 +1100 Subject: [PATCH] Optimized selectors in another tight loop Found another selector repeat inside of a tight loop. Cached the selector before entering loop --- js/foundation/foundation.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/foundation/foundation.js b/js/foundation/foundation.js index ad3385303..c02ddf70a 100644 --- a/js/foundation/foundation.js +++ b/js/foundation/foundation.js @@ -73,10 +73,11 @@ var header_helpers = function (class_array) { var i = class_array.length; + var head = $('head'); while (i--) { - if($('head').has('.' + class_array[i]).length === 0) { - $('head').append(''); + if(head.has('.' + class_array[i]).length === 0) { + head.append(''); } } }; -- 2.47.2