[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
This commit is contained in:
Xavier Morel 2011-06-21 11:18:36 +02:00
parent 6371d8f840
commit 7d9263a85c
1 changed files with 2 additions and 2 deletions

View File

@ -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, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
s = String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
if (attribute) {
s = s.replace(/"/g, '&quot;');
}