When using JavaScript to perform DOM operations, you will always encounter interesting things depending on the browser. The problem described this time is related to the Association of IE6 and innerHTML: Detailed records. When ie6 operates on the innerHTML and dom of the deleted node, the memory of the deleted node will no longer be released, setting the attribute and css for deleting a node is no problem.
Attention is often paid to the callback processing node in xhr. The node to be processed may have been deleted.
Test code:
- < Div Id="P">
- < A Id="C">
- Xx
- </>
- </Div>
-
-
- < Script>
- Window. onload=Function(){
- VarA=Document. GetElementById ("c ");
- Document. getElementById ("p "). InnerHTML="";
- // Css, attribute no problem
- //A. style. width="1px";
- //A. href="Xx";
- // Set innerHTML to change the innerHTML Association.
- A. innerHTML='Yy';
- // Neither dom a nor span can be released
- // A. appendChild (document. createElement ("span "));
- //A=Null;
- }
- </Script>
Under normal circumstances:
After the page is executed, there are 6 in-use nodes and a has been released.
InnerHTML Association:
Changed 7 innerHTML in-use nodes of the deleted node, and a cannot be released.
- Detailed description of Array extensions in Javascript
- What is JSON? Data format prepared for JavaScript
- 10 most commonly used JavaScript udfs
- Some extended thoughts on loading JavaScript events
- Summary of JavaScript usage: From BOM and DOM