我正在执行大量的DOM操作(例如,将位于彼此下方的div中的图像移动到堆叠顺序中,并将所有div移出舞台w/e外部“js”文件使用ready事件(“js”文件包含在“css”文件后面的头部)。jQuery脚本不会执行,直到DOM完全加载到IE8中
jQuery(function($) {
:
:
});
我在使用Firefox和Safari(单步执行)时发现,DOM上的操作是在代码执行时发生的。如果代码在div上执行移动,则div移动。
在IE8上,使用调试器不会发生。直到脚本返回到jQuery库才执行任何操作;该库,然后验证DOM是完全加载,然后所有的jQuery操作立即执行。
我正在使用jQuery-1.4.4,下面的IE8库中的步骤是发生了什么。 (注:评论是那些线以上
Line 452 - Trigger any bound events
Line 417 - Handle when the DOM is ready
Line 422 - Make sure the DOM is not already loaded
Line 424 - Make sure body exists
Line 429 - Remember that the DOM is ready
Line 432 - If a normal DOM Ready event fired, decrement ..
Line 437 - If there are functions bound, to execute (my script executes at this point)
Line 890 - The DOM ready check for IE
Firefox时,我的脚本返回
Line 452 - Trigger any bound events
Line 855 - Cleanup functions for the document ready method
因此执行在库中的以下行,我所看到的是干净的渲染在Firefox中,。在OSX和XP中的Safari和Chrome在XP IE8中,一切看起来好像JavaScript被禁用,直到DOM被完全加载。
请问,我需要一些关于如何纠正这个问题的建议
我也注意到了这一点,它会导致一些非常波涛汹涌的负载。我很想看到修复。 – 2010-12-02 18:19:42