Mozilla文檔上的例子,這個是在IE6,7里的,https://developer.mozilla.org/en-US/docs/JavaScript/Memory_Managementvardiv=document.createElement("div");div.onclick=function(){doSomething();};//Thedivhasareferencetotheeventhandlerviaits'onclick'property//Thehandleralsohasareferencetothedivsincethe'div'variablecanbeaccessedwithinthefunctionscope//Thiscyclewillcausebothobjectsnottobegarbage-collectedandthusamemoryleak.這里說的,函數(shù)里有一個對div的引用,可是在哪,是this么?在ChromeFirefox里是否有類似的內(nèi)存泄漏問題?這是語言設(shè)計的失誤么?
JS 的循環(huán)引用, 原因是什么?
四季花海
2019-04-07 09:38:00