J
JT
arghh.. I am writing a web app for real-time streaming of market data
(equities) and am implementing a quick getElementsById function as
needed; in gecko FF this is a walk with document.evaluate. In IE i am
using document.all (i presume this is the only efficient alternative
for IE, am i correct?)..
Anyway the madness is this:
var _sID = "501"; // some arbitrary ID which exists in the hierarchy.
var result1 = (typeof document.all[_sID]); //result1 = undefined
// However
for (var x in document.all)
{
if(x == _sID ) //this case is eventually hit (i.e equals true at a
given point)
result2 = document.all[x]; // result2 = is also undefined!!!!
}
Now why would IE say that result2 is undefined when that value was
returned in the enumeration.
Some debugging reveals that this problem only occurs with pure
numerical IDs!!! So pre-pending any market code with an arbitrary
string solves the problem!!! Truly i would love to know what the IE
team was thinking when they implemented this collection!!!
Any thoughts on this? Thank you.
(equities) and am implementing a quick getElementsById function as
needed; in gecko FF this is a walk with document.evaluate. In IE i am
using document.all (i presume this is the only efficient alternative
for IE, am i correct?)..
Anyway the madness is this:
var _sID = "501"; // some arbitrary ID which exists in the hierarchy.
var result1 = (typeof document.all[_sID]); //result1 = undefined
// However
for (var x in document.all)
{
if(x == _sID ) //this case is eventually hit (i.e equals true at a
given point)
result2 = document.all[x]; // result2 = is also undefined!!!!
}
Now why would IE say that result2 is undefined when that value was
returned in the enumeration.
Some debugging reveals that this problem only occurs with pure
numerical IDs!!! So pre-pending any market code with an arbitrary
string solves the problem!!! Truly i would love to know what the IE
team was thinking when they implemented this collection!!!
Any thoughts on this? Thank you.