开发者

IE8 JavaScript Debugger: where the heck is the DOM tree?

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:

IE8 JavaScript Debugger: where the heck is the DOM tree?

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, dan开发者_如何学Cg 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' );


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.

    ...
    ...
    </body>
    <script type='text/javascript'>
     position_col_heads();//Set breakpoint here and see if its accessible.
    </script>
</html>

Also, see what response you get for main.children[0] and main_tbody.innerHTML in your watch expression.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜