var div = document.createElement("div");div.onclick = function(){ doSomething(); }; // The div has a reference to the event handler via its 'onclick' property// The handler also has a reference to the div since the 'div' variable can be accessed within the function scope// This cycle will cause both objects not to be garbage-collected and thus a memory leak.
这里说的, 函数里有一个对 div
的引用, 可是在哪, 是 this
么?
这是语言设计的失误么?
月关宝盒
叮当猫咪
相关分类