IE8 JavaScript 调试器:DOM 树到底在哪里?
我正在使用 IE8 调试器修复一个在 FF 3.16 和 Chrome 12.0 中运行良好的脚本,但不适用于 IE 8.0 或 Safari 5.0 中的 beans。脚本中给我带来麻烦的地方是:
我需要找到 的数量
,其 table id="main_tbody"
中的children[0]
是第一行数据。 FF 和 Chrome 都非常明白这一点; IE 8 和 Safari 5 没有。
我想查看 IE 8 调试器中的 DOM 树,看看发生了什么。但我找不到叮咚的 DOM,该死!
那么:IE 8 调试器中的 DOM 在哪里?
或者<咳咳!>:我的 JS 代码出了什么问题?
谢谢!
编辑:我应该说表格是这样设置的:
<table id ="main">
<tbody id="main_tbody">
以及对table id ="main"
和tbody id="main_tbody"
的引用code> 是这样初始化的:
main = getRefToDiv( 'main' );
main_tbody = getRefToDiv( 'main_tbody' );
I'm using the IE8 debugger to fix a script that works great in FF 3.16 and Chrome 12.0, but doesn't work for beans in IE 8.0 or Safari 5.0. The spot in the script that's giving me trouble is here:
I need to find the number of <td>
s in the the table id="main_tbody"
whose children[0]
is the first row of data. Both FF and Chrome understand this perfectly; IE 8 and Safari 5 do not.
I want to look at the DOM tree in the IE 8 debugger to see what's going on. But I can't find the ding-dong DOM, dang it!
So: where is the DOM in the IE 8 debugger?
Alternatively <ahem!>: what's wrong with my JS code?
Thanks!
EDIT: I should have said that the table is set up like this:
<table id ="main">
<tbody id="main_tbody">
And references to table id ="main"
and tbody id="main_tbody"
are initialized this way:
main = getRefToDiv( 'main' );
main_tbody = getRefToDiv( 'main_tbody' );
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在
之后调用position_col_heads()函数
我怀疑该函数是在 head 标签内声明的,或者是在浏览器呈现正文内容之前调用的。
试试这个吧。
另外,请查看您在监视表达式中对 main.children[0] 和 main_tbody.innerHTML 获得的响应。
Call the position_col_heads() function after your
</body>
My suspicion is that this function is declared inside the head tag or being called before the browser renders the body content.
Just try this.
Also, see what response you get for main.children[0] and main_tbody.innerHTML in your watch expression.
难以置信。根据quirksmode,ie8无法实现childElementCount 我相信这一点,因为这就是返回的东西==“未定义”。所以我将用新的退出条件重写我的循环。这很糟糕,因为现在我将获得所有子项,包括评论和其他所有内容,而不仅仅是我正在寻找的元素。极好的。仅供参考,ie8 也没有实现 firstElementChild、lastElementChild、nextElementSibling 或 previousElementSibling。
Unbelievable. According to quirksmode, ie8 fails to implement childElementCount and I believe it because that's the thing that's coming back == 'undefined'. So I'll rewrite my loop with a new exit condition. That sucks, because now I'm going to get all children, including comments and everything else, not just the elements I was looking for. Incredible. FYI, ie8 also does not implement firstElementChild, lastElementChild, nextElementSibling, or previousElementSibling.