I'm not aware of any way to do this, however to keep the iterations to a minimum, you could try checking for the existance of __count__
and if it doesn't exist (ie not Firefox) then you could iterate over the object and define it for later use eg:
if (myobj.__count__ === undefined) {
myobj.__count__ = ...
}
This way any browser supporting __count__
would use that, and iterations would only be carried out for those which don't. If the count changes and you can't do this, you could always make it a function:
if (myobj.__count__ === undefined) {
myobj.__count__ = function() { return ... }
myobj.__count__.toString = function() { return this(); }
}
This way anytime you reference myobj.__count__
the function will fire and recalculate.