[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:
parent
6371d8f840
commit
7d9263a85c
|
@ -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, '<').replace(/>/g, '>');
|
||||
s = String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
if (attribute) {
|
||||
s = s.replace(/"/g, '"');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue