firebug - Intermittent JavaScript Issue -


i'm running javascript via eval (i know, shoot me), enumerates of properties on document object. issue while works in firebug, throws not implemented exception in firefox, when run script.

link javascript script, exception thrown, , firebug command working.

any suggestions what's going on here?

for record, done on firefox 3.6.10 on ubuntu 10.04 64-bit, , chrome not have issue.

the error here:

console.log(result); 

remove line , should fine.

the console object firebug thing (refers firebug console). safari/chrome happen implement console object (refers webkit js console). firefox, indeed other browsers don't have console object. throws error.

btw: usual, evals unnecessary. equivalent code:

for (key in document) {     result[i] = typeof document[key];     result[i+1]="document."+key;     i+=2; } 

if insist on calling request use reference:

var request = window.document; (key in request) {     result[i] = typeof request[key];     result[i+1]=request+"."+key;     i+=2; } 

if insist on passing object names string, sanity's sake use eval in less confusing way:

var string = "window.document"; eval("var request ="+string); (key in request) {     result[i] = typeof request[key];     result[i+1]=request+"."+key;     i+=2; } 

though wouldn't (sometimes necessary, rarely).


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -