ÈçºÎ±ÜÃâJavascriptʼþ°ó¶¨³öÏÖÄÚ´æÐ¹Â©
"These memory leaks often
occur as a result of circular references between JavaScript objects and
objects within IE’s DOM (document object model)."
GPDE Team Blog
Ã÷ÏÔµÄDOM¶ÔÏóÓë JavaScript¶ÔÏóÑ»·ÒýÓúܺÃÅжϣ¬ÄѵÄÊÇÒþº¬µÄÑ»·ÒýÓÃÅжϣ¡
Òþº¬µÄÑ»·ÒýÓÃÐèҪͨ¹ý×÷ÓÃÓòÁ´½øÐзÖÎöÅжϣ¡
¿¼ÂÇÒÔÏ´úÂë(¸Ðл¿É°®µÄwinter ^_^)£º
var e=document.getElementBy??("XX");
e.onclick=function(){}
scopechain·ÖÎö£º
scopechain.e = document.getElementBy??("XX");
function f(){}
function f(){}.[[scope]] = scopechain
e.onclick = f
ºÜÇåÎú£¬¶Ô²»¶Ô£¿
"Javascript°ó¶¨Ê¼þʱ£¬Ö»ÒªDOMµÄʼþÀï·ÃÎʲ»ÁËDOM×Ô¼ºµÄÄǸö±äÁ¿¾ÍÐÐÁË"
winter
"IEÏÖÔÚµÄPatch¸ãµÃÓÐʱºòй¶ÓÐʱºò²»Ð¹Â¶"
winter
<button id="testx">No Memory Leak Event Bind</button>
<button id="testy">No Memory Leak Event Bind</button>
<script type="text/javascript">
var fooA = function(){
var f = function(){alert(this+'\n'+fooA);}
!function(){
var d = document.getElementById('testx');
d.onclick = f;
}()
}
fooA();
var fooB = function(){
this.onclick = function(){alert(this+'\n'+fooB);}
}
fooB.call(document.getElementById('testy'));
</script>
Ïà¹ØÎĵµ£º
CSS¸´ºÏЧ¹û
CSSµÄЧ¹ûÊÇ¿ÉÒÔÖØµþµÄ£¬ÀýÈçclass="a b"£¬ÄÇôÕâ¸ö½Úµã¾ÍͬʱӵÓÐÁËaºÍbµÄÊôÐÔ£¬²¢ÇÒ£¬b¿ÉÒÔ¸²¸ÇaµÄÊôÐÔ¡£
JavaScriptÔÚHtmlÖеÄÖ´ÐÐ˳Ðò
¾¹ý¼òµ¥²âÊÔ£¬·¢ÏÖJavaScriptµÄÖ´ÐÐ˳ÐòÊǰ´ÕÕjsµÄ¼ÓÔØË³Ðò½øÐе쬶øonloadº¯ÊýÊÇÔÚÕû¸öÒ³Ãæ¼ÓÔØÍê³Éºó²Å¿ªÊ¼Ö´ÐС£
ÎҵIJâÊÔÎļþ£º
<!--
To change this ......
FusionChart ¾Í²»ÓýéÉÜÁ˰ѣ¬Ò»¿îÖ§³Ö¶àÖÖÓïÑÔµÄͼ±íÉú³É¿Ø¼þ£¬Éú³ÉµÄͼ±í·á¸»£¬ÃÀ¹Û£¬ÇÒÓж¯Ì¬¸Ð£¬ÒòΪËüÉú´æµÄ¶«Î÷¾ÍÊÇÒ»¸öflash¡£Ò»Ï½éÉÜÒ»ÏÂËüµÄjavascript ʵÏÖ·½Ê½°Ñ¡£
·Ï»°ÉÙ˵£¬Ö±½ÓÉÏʵÀý
<HTML>¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡ <HEAD>¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡ <SCRIPT LANGUAGE="Javascri ......
µÚÒ»ÖÖ·½·¨£ºÊ¹ÓÃinsertRowÌí¼ÓÐУ¬Ê¹ÓÃinsertCellÌí¼Óµ¥Ôª¸ñ£¬ÔÙÓÃinnerHTMLÌî³äµ¥Ôª¸ñ¡£Ê¹ÓÃdeleteRowɾ³ýÐУ¬´úÂëÈçÏ£º
Javascript´úÂ룺
function addRow()
{
var root = document.getElementById("tbody")
var&nb ......
Ò»¡¢ÉùÃ÷×Ö·û´®:
var normal_monkey = "I am a monkey!<br>";
document.writeln("Normal monkey " + normal_monkey);
var bold_monkey = normal_monkey.bold();
document.writeln("Bold monkey "&n ......
±Õ°ü£¨closure£©ÊÇJavascriptÓïÑÔµÄÒ»¸öÄѵ㣬ҲÊÇËüµÄÌØÉ«£¬ºÜ¶à¸ß¼¶Ó¦Óö¼ÒªÒÀ¿¿±Õ°üʵÏÖ¡£
ÏÂÃæ¾ÍÊÇÎÒµÄѧϰ±Ê¼Ç£¬¶ÔÓÚJavascript³õѧÕßÓ¦¸ÃÊǺÜÓÐÓõġ£
Ò»¡¢±äÁ¿µÄ×÷ÓÃÓò
ÒªÀí½â±Õ°ü£¬Ê×ÏȱØÐëÀí½âJavascriptÌØÊâµÄ±äÁ¿×÷ÓÃÓò¡£
±äÁ¿µÄ×÷ÓÃÓòÎ޷ǾÍÊÇÁ½ÖÖ£ºÈ«¾Ö±äÁ¿ºÍ¾Ö²¿±äÁ¿¡£
JavascriptÓïÑÔµÄÌØÊâÖ®´¦£¬¾ÍÔ ......