Few days ago, I’m assigned a task to fix a problem: IE showed an error message box and crashed when load a heavy page (it took about 40-50s to load completly) .
- The HTML file is being parsed
- Script is executing
- The executing script attempts to add, or remove an element from an unclosed ancestor in the markup tree (not including the script block’s immediate parent element).
So I refactored code by move all JS functions call into $(document).ready( … ) (I’m using jQuery) to make sure the script will be executed after the page loaded successful. whew, the problem has been resolved 🙂