From 7d9263a85c426e043abbc06cb3b80e935e811dea Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 21 Jun 2011 11:18:36 +0200 Subject: [PATCH] [IMP] converting values to strings with (new String) is 10~20% slower than using just String(). Switch Qweb.html_escape to String() bzr revid: xmo@openerp.com-20110621091836-5cnjwac3m3n12380 --- addons/base/static/lib/qweb/qweb2.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/base/static/lib/qweb/qweb2.js b/addons/base/static/lib/qweb/qweb2.js index 5067d30d70e..5041142924d 100644 --- a/addons/base/static/lib/qweb/qweb2.js +++ b/addons/base/static/lib/qweb/qweb2.js @@ -35,10 +35,10 @@ var QWeb2 = { return (noquotes ? '' : "'") + s.replace(/\r?\n/g, "\\n").replace(/'/g, "\\'") + (noquotes ? '' : "'"); }, html_escape: function(s, attribute) { - if (s === null || s === undefined) { + if (s == null) { return ''; } - s = (new String(s)).replace(/&/g, '&').replace(//g, '>'); + s = String(s).replace(/&/g, '&').replace(//g, '>'); if (attribute) { s = s.replace(/"/g, '"'); }