Kaynağa Gözat

fix bug with eventDestroy not being called

Adam Shaw 11 yıl önce
ebeveyn
işleme
c64e483353
3 değiştirilmiş dosya ile 4 ekleme ve 5 silme
  1. 1 2
      src/agenda/AgendaView.js
  2. 2 2
      src/basic/BasicView.js
  3. 1 1
      src/common/View.js

+ 1 - 2
src/agenda/AgendaView.js

@@ -357,6 +357,7 @@ $.extend(AgendaView.prototype, {
 
 	// Unrenders all event elements and clears internal segment data
 	destroyEvents: function() {
+		View.prototype.destroyEvents.call(this); // do this before the grids' segs have been cleared
 
 		// if destroyEvents is being called as part of an event rerender, renderEvents will be called shortly
 		// after, so remember what the scroll value was so we can restore it.
@@ -371,8 +372,6 @@ $.extend(AgendaView.prototype, {
 		// we DON'T need to call updateHeight() because:
 		// A) a renderEvents() call always happens after this, which will eventually call updateHeight()
 		// B) in IE8, this causes a flash whenever events are rerendered
-
-		View.prototype.destroyEvents.call(this); // call the super-method
 	},
 
 

+ 2 - 2
src/basic/BasicView.js

@@ -250,14 +250,14 @@ $.extend(BasicView.prototype, {
 
 	// Unrenders all event elements and clears internal segment data
 	destroyEvents: function() {
+		View.prototype.destroyEvents.call(this); // do this before dayGrid's segs have been cleared
+
 		this.recordScroll(); // removing events will reduce height and mess with the scroll, so record beforehand
 		this.dayGrid.destroyEvents();
 
 		// we DON'T need to call updateHeight() because:
 		// A) a renderEvents() call always happens after this, which will eventually call updateHeight()
 		// B) in IE8, this causes a flash whenever events are rerendered
-
-		View.prototype.destroyEvents.call(this); // call the super-method
 	},
 
 

+ 1 - 1
src/common/View.js

@@ -175,7 +175,7 @@ View.prototype = {
 
 
 	// Removes event elements from the view.
-	// Should be overridden by subclasses. Actual element destruction should happen first, then call super-method.
+	// Should be overridden by subclasses. Should call this super-method FIRST, then subclass DOM destruction.
 	destroyEvents: function() {
 		this.segEach(function(seg) {
 			this.trigger('eventDestroy', seg.event, seg.event, seg.el);