From: Thomas Tanghus Date: Wed, 28 Aug 2013 10:50:05 +0000 (+0200) Subject: Cache Object.keys(this.vars) X-Git-Tag: v6.0.0alpha2~260^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=776d64f804534eee724a9cd08f6c242002a75ddc;p=nextcloud-server.git Cache Object.keys(this.vars) --- diff --git a/core/js/octemplate.js b/core/js/octemplate.js index f7ee316f3b2..46ffa976574 100644 --- a/core/js/octemplate.js +++ b/core/js/octemplate.js @@ -60,9 +60,10 @@ var self = this; if(typeof this.options.escapeFunction === 'function') { - for (var key = 0; key < Object.keys(this.vars).length; key++) { - if(typeof this.vars[Object.keys(this.vars)[key]] === 'string') { - this.vars[Object.keys(this.vars)[key]] = self.options.escapeFunction(this.vars[Object.keys(this.vars)[key]]); + var keys = Object.keys(this.vars); + for (var key = 0; key < keys.length; key++) { + if(typeof this.vars[keys[key]] === 'string') { + this.vars[keys[key]] = self.options.escapeFunction(this.vars[keys[key]]); } } }