Bug 720981 - Remove element.iQEventData when it's empty. r=ttaubert

This commit is contained in:
Dão Gottwald 2012-01-25 13:40:11 +01:00
Родитель eae83ede2d
Коммит 894f5e0fe4
1 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -741,6 +741,11 @@ iQClass.prototype = {
if (pair.original == func) {
handler = pair.modified;
elem.iQEventData[type].splice(a, 1);
if (!elem.iQEventData[type].length) {
delete elem.iQEventData[type];
if (!Object.keys(elem.iQEventData).length)
delete elem.iQEventData;
}
break;
}
}
@ -765,10 +770,10 @@ iQClass.prototype = {
if (!elem.iQEventData)
continue;
for (let type in elem.iQEventData) {
while (elem.iQEventData[type].length)
Object.keys(elem.iQEventData).forEach(function (type) {
while (elem.iQEventData && elem.iQEventData[type])
this.unbind(type, elem.iQEventData[type][0].original);
}
}, this);
}
return this;