Skip to content

Commit

Permalink
Updated popcorn-base with teardown bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchirls committed Apr 10, 2012
1 parent 91bd439 commit ff23cd2
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions js/popcorn-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@
teardownFn = definition._teardown;
if (typeof teardownFn === 'function') {
definition._teardown = function(options) {
var parent;
var parent, i;
if (typeof me.onTeardown === 'function') {
try {
me.onTeardown.call(me, options);
Expand All @@ -414,27 +414,39 @@
}
}
teardownFn.call(me, options);
if (me.container && me.container.parentNode) {
if (me.container) {
parent = me.container.parentNode;
parent.removeChild(me.container);
if (parent) {
parent.removeChild(me.container);
}
delete me.container;
}
i = allEvents.indexOf(me);
if (i <= 0) {
allEvents.splice(i, 1);
}
};
} else {
definition._teardown = function(options) {
var parent;
var parent, i;
if (typeof me.onTeardown === 'function') {
try {
me.onTeardown(options);
} catch (e) {
logError(e);
}
}
if (me.container && me.container.parentNode) {
if (me.container) {
parent = me.container.parentNode;
parent.removeChild(me.container);
if (parent) {
parent.removeChild(me.container);
}
delete me.container;
}
i = allEvents.indexOf(me);
if (i <= 0) {
allEvents.splice(i, 1);
}
};
}
};
Expand Down

0 comments on commit ff23cd2

Please sign in to comment.