问题
When I call this line:
Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML")
For FireBug it returns:
>>> Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML")
where for IE, Developer Tools it returns:
>> Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML")
{
get : function innerHTML() { [native code] } ,
set : function innerHTML() { [native code] } ,
enumerable : true,
configurable : true
}
Do you know why it is different? Why IE Dev. Tools seems to be more descriptive than FireBug for this case?
回答1:
Because the way Firebug runs your input generates an exception, which is then in turn hidden by Firebug. Try running:
try { Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML") } catch (ex) { console.log(ex); }
And you'll see what I mean. As @lonesomeday suggested, try using the web console instead.
来源:https://stackoverflow.com/questions/6262132/why-ie-developer-tools-seems-to-be-more-descriptive-than-firebug-in-this-example