Javascript performing differently in different browsers
Posted: Thu Jun 26, 2008 11:18 am
Consider the following code:
The loop continues, but I have located the error to be here.
In Firefox and Safari, this spits out a list of items in the specific divs as it should, but in IE it first spits out the entire, unmodified page, then the list of items, and then stops executing with an error. Is this a difference in how the browsers handle regular expressions, or a behaviour of the match function?
Code: Select all
reg=/<div class=\"dataset\">.+<\/div>/g;
sets=content.match(reg);
for (item in sets) {
name=sets[item].replace("</div>","");
name=name.replace("<div class=\"dataset\">",""); //this line causes the error
page+='<tr><th scope="row">'+name+'</th><td>';
...In Firefox and Safari, this spits out a list of items in the specific divs as it should, but in IE it first spits out the entire, unmodified page, then the list of items, and then stops executing with an error. Is this a difference in how the browsers handle regular expressions, or a behaviour of the match function?