Hi,
Not sure it's an issue but you might be interested in my observations.
I've noticed that in several occasions jquery currency uses this code to get or
set the value/content of an elemnt :
to get : control.is('input, select, textarea') ? 'val' : 'html']()
to set : control[control.is('input, select, textarea') ? 'val' : 'html'](value);
I'm using jquery currency in a table that can contain several hundreds to
thousands of numbers to "currencify" and i was having performance issues.
I have replaced the above code by using this type of methods :
function GetControlValue(id) {
var c = document.getElementById(id);
switch (c.tagName.toLocaleLowerCase()) {
case "input":
case "select":
case "textarea":
return c.value;
default:
if (typeof (c.textContent) != "undefined")
return c.textContent;
else
return c.innerText;
}
}
function SetControlValue(ctrl, value) {
var c = document.getElementById(ctrl);
switch (c.tagName.toLocaleLowerCase()) {
case "input":
case "select":
case "textarea":
c.value = value;
break;
default:
if (typeof (c.textContent) != "undefined")
c.textContent = value;
else
c.innerText = value;
}
}
It should be cross browser (I havent fully tested as it is sufficient for my
own needs and the browsers we support). However the performance gap is pretty
big so you might want to look into it.
in IE9, calling it 1049 times, i spent 3093ms in formatCurrency. By using my
Get/Set method i spent 421ms.
Gap in IE7 and 8 was similarly important, in other browsers (chrome and ffx) it
was not to big as the performance using jquery html method was already very
good in these browsers. Didn't try in Opera.
Thanks for the great library btw
best regards
Jerome
Original issue reported on code.google.com by jerome.s...@gmail.com on 7 Mar 2012 at 10:36
Original issue reported on code.google.com by
jerome.s...@gmail.com
on 7 Mar 2012 at 10:36