标签:style class blog code java http
groot.createElement = function (html, id) { groot.dynamic[id] = id; return $(html).append("<input type=‘hidden‘ id=\"" + id + "\">") }
从上面得代码可以看出
函数在html代码片段的后面加了隐藏的input
并在 groot.dynamic加了添加了一个属性
function _collection() {//垃圾回收
if (_collect) {
_collect = false;
groot.asyn(function () {
for (var id in groot.dynamic) {
if ($("#" + id).length <= 0) {
delete groot.vms[id];
delete groot.dynamic[id];
}
}
_collect = true;
})
}
}
看下面的回收函数
回收的时候程序会从groot.dynamic循环判断 页面还存在不存在对应的那个input
不存在的话 就说明 对应的html代码不存在了 就需要回收了
标签:style class blog code java http
原文地址:http://www.cnblogs.com/blowfish/p/3784752.html