0

当我调用此行时:

Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML") 

对于FireBug,它返回

>>> Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML") 

对于 IE,它返回的开发者工具在哪里:

>> Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML") 
{
    get :  function innerHTML() {     [native code] } ,
    set :  function innerHTML() {     [native code] } ,
    enumerable : true,
    configurable : true
} 

你知道为什么不一样吗?为什么选择 IE 开发。对于这种情况,工具似乎比 FireBug 更具描述性?

4

1 回答 1

3

因为 Firebug 运行您的输入的方式会生成一个异常,然后它又被 Firebug 隐藏。尝试运行:

try { Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML") } catch (ex) { console.log(ex); }

你会明白我的意思。正如@lonesomeday 建议的那样,尝试改用网络控制台。

于 2011-06-07T07:58:41.640 回答