Why IE Developer Tools seems to be more descriptive than FireBug in this example?

℡╲_俬逩灬. 提交于 2019-12-25 02:15:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!