So, I've been tasked with maintaining a legacy application and trying to make it cross browser. I've stumbled across posts like this (Javascript: access DOM elements without getElementById) which articulate the issue that I have.
Namely, in IE, you can work with an element in the DOM by just calling it by its ID. It's non-standard but it works. Obviously, the second you go to Chrome or Firefox, none of the old code works anymore, as Chrome or FF depends on you using something like getElementByID (which is the correct, standards based way).
This application also uses things like document.all to find if certain controls are there, and if they are, to work with them. This all happens without getElementByID.
So, is there an easy way to find this kind of IE dependent code so I can strip it out and replace it with something more modern? Or not really?
Thanks!
EDIT:
So, this is some of the code that is in the existing JS
for (var i = 0; i < grdPreviousEpisode.rows.length; i++)
...
}
Now, grdPreviousEpisode is a GridView (in Web Forms). This is manifested as a HTML table. This code isn't using a "getElementById" function to go and pull this out of the DOM "the right way". Its relying on IE's terribad way of passing items through out of the DOM when there isn't a visible JS variable.
There may be other areas in this code which specifically rely on IE dependent hacks, and I would like to not have to manually find/replace those things. Does that make sense?