gpt4 book ai didi

javascript - Firefox 中的 console.dir(window)?

转载 作者:搜寻专家 更新时间:2023-11-01 04:27:33 25 4
gpt4 key购买 nike

console.dir(window) 在 Chrome 中:

http://ecmazing.com/unsorted/console-dir-window-in-chrome.png

console.dir(window) 在 Firebug 中(在 Firefox 7 中):

http://ecmazing.com/unsorted/console-dir-window-in-firebug.png

为什么 Firebug 只列出 window 对象的几个属性?如何列出 Firefox 中的所有全局属性?

此外,__proto__ 属性在哪里,以便我可以跟踪原型(prototype)链?

最佳答案

看起来 Firebug 正在过滤掉不满足 hasOwnProperty 的属性。例如,当使用 Firefox 4/Firebug 1.7 投资 DOM 时,navigatoraddHandler 出现,但 confirm 没有出现。观察:

>>> window.hasOwnProperty('confirm')
false
>>> window.hasOwnProperty('addHandler')
true
>>> window.hasOwnProperty('navigator')
true

但是,Date 没有显示,并且:

>>> window.hasOwnProperty('Date')
true

所以它似乎也在过滤掉全局构造函数,这似乎被 comment 9 证实了在 this bug .我不知道使用什么函数来过滤掉这些构造函数。

不管怎样,我还没有找到解决这个问题的方法。如果我这样做了,我会通知你,但我认为在撰写本文时,没有办法做你想做的事。

关于javascript - Firefox 中的 console.dir(window)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5412176/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com