Browse Source

change terminology "destroy" -> "unrender"

Adam Shaw 10 years ago
parent
commit
8090f63e34

+ 2 - 2
src/Calendar.js

@@ -513,7 +513,7 @@ function Calendar_constructor(element, overrides) {
 			// It is still the "current" view, just not rendered.
 		}
 
-		header.destroy();
+		header.removeElement();
 		content.remove();
 		element.removeClass('fc fc-ltr fc-rtl fc-unthemed ui-widget');
 
@@ -538,7 +538,7 @@ function Calendar_constructor(element, overrides) {
 	function renderView(viewType) {
 		ignoreWindowResize++;
 
-		// if viewType is changing, destroy the old view
+		// if viewType is changing, remove the old view's rendering
 		if (currentView && viewType && currentView.type !== viewType) {
 			header.deactivateButton(currentView.type);
 			freezeContentHeight(); // prevent a scroll jump when view element is removed

+ 3 - 2
src/Header.js

@@ -8,7 +8,7 @@ function Header(calendar, options) {
 	
 	// exports
 	t.render = render;
-	t.destroy = destroy;
+	t.removeElement = removeElement;
 	t.updateTitle = updateTitle;
 	t.activateButton = activateButton;
 	t.deactivateButton = deactivateButton;
@@ -39,8 +39,9 @@ function Header(calendar, options) {
 	}
 	
 	
-	function destroy() {
+	function removeElement() {
 		el.remove();
+		el = $();
 	}
 	
 	

+ 15 - 15
src/agenda/AgendaView.js

@@ -52,7 +52,7 @@ var AgendaView = View.extend({
 
 
 	// Renders the view into `this.el`, which has already been assigned
-	render: function() {
+	renderDates: function() {
 
 		this.el.addClass('fc-agenda-view').html(this.renderHtml());
 
@@ -81,12 +81,12 @@ var AgendaView = View.extend({
 
 	// Unrenders the content of the view. Since we haven't separated skeleton rendering from date rendering,
 	// always completely kill each grid's rendering.
-	destroy: function() {
-		this.timeGrid.destroyDates();
+	unrenderDates: function() {
+		this.timeGrid.unrenderDates();
 		this.timeGrid.removeElement();
 
 		if (this.dayGrid) {
-			this.dayGrid.destroyDates();
+			this.dayGrid.unrenderDates();
 			this.dayGrid.removeElement();
 		}
 	},
@@ -225,7 +225,7 @@ var AgendaView = View.extend({
 
 		// limit number of events in the all-day area
 		if (this.dayGrid) {
-			this.dayGrid.destroySegPopover(); // kill the "more" popover if displayed
+			this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed
 
 			eventLimit = this.opt('eventLimit');
 			if (eventLimit && typeof eventLimit !== 'number') {
@@ -316,12 +316,12 @@ var AgendaView = View.extend({
 
 
 	// Unrenders all event elements and clears internal segment data
-	destroyEvents: function() {
+	unrenderEvents: function() {
 
-		// destroy the events in the subcomponents
-		this.timeGrid.destroyEvents();
+		// unrender the events in the subcomponents
+		this.timeGrid.unrenderEvents();
 		if (this.dayGrid) {
-			this.dayGrid.destroyEvents();
+			this.dayGrid.unrenderEvents();
 		}
 
 		// we DON'T need to call updateHeight() because:
@@ -345,10 +345,10 @@ var AgendaView = View.extend({
 	},
 
 
-	destroyDrag: function() {
-		this.timeGrid.destroyDrag();
+	unrenderDrag: function() {
+		this.timeGrid.unrenderDrag();
 		if (this.dayGrid) {
-			this.dayGrid.destroyDrag();
+			this.dayGrid.unrenderDrag();
 		}
 	},
 
@@ -369,10 +369,10 @@ var AgendaView = View.extend({
 
 
 	// Unrenders a visual indications of a selection
-	destroySelection: function() {
-		this.timeGrid.destroySelection();
+	unrenderSelection: function() {
+		this.timeGrid.unrenderSelection();
 		if (this.dayGrid) {
-			this.dayGrid.destroySelection();
+			this.dayGrid.unrenderSelection();
 		}
 	}
 

+ 10 - 10
src/basic/BasicView.js

@@ -52,7 +52,7 @@ var BasicView = View.extend({
 
 
 	// Renders the view into `this.el`, which should already be assigned
-	render: function() {
+	renderDates: function() {
 
 		this.dayNumbersVisible = this.dayGrid.rowCnt > 1; // TODO: make grid responsible
 		this.weekNumbersVisible = this.opt('weekNumbers');
@@ -72,8 +72,8 @@ var BasicView = View.extend({
 
 	// Unrenders the content of the view. Since we haven't separated skeleton rendering from date rendering,
 	// always completely kill the dayGrid's rendering.
-	destroy: function() {
-		this.dayGrid.destroyDates();
+	unrenderDates: function() {
+		this.dayGrid.unrenderDates();
 		this.dayGrid.removeElement();
 	},
 
@@ -216,7 +216,7 @@ var BasicView = View.extend({
 		unsetScroller(this.scrollerEl);
 		uncompensateScroll(this.headRowEl);
 
-		this.dayGrid.destroySegPopover(); // kill the "more" popover if displayed
+		this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed
 
 		// is the event limit a constant level number?
 		if (eventLimit && typeof eventLimit === 'number') {
@@ -272,8 +272,8 @@ var BasicView = View.extend({
 
 
 	// Unrenders all event elements and clears internal segment data
-	destroyEvents: function() {
-		this.dayGrid.destroyEvents();
+	unrenderEvents: function() {
+		this.dayGrid.unrenderEvents();
 
 		// we DON'T need to call updateHeight() because:
 		// A) a renderEvents() call always happens after this, which will eventually call updateHeight()
@@ -291,8 +291,8 @@ var BasicView = View.extend({
 	},
 
 
-	destroyDrag: function() {
-		this.dayGrid.destroyDrag();
+	unrenderDrag: function() {
+		this.dayGrid.unrenderDrag();
 	},
 
 
@@ -307,8 +307,8 @@ var BasicView = View.extend({
 
 
 	// Unrenders a visual indications of a selection
-	destroySelection: function() {
-		this.dayGrid.destroySelection();
+	unrenderSelection: function() {
+		this.dayGrid.unrenderSelection();
 	}
 
 });

+ 4 - 4
src/common/DayGrid.events.js

@@ -8,9 +8,9 @@ DayGrid.mixin({
 
 
 	// Unrenders all events currently rendered on the grid
-	destroyEvents: function() {
-		this.destroySegPopover(); // removes the "more.." events popover
-		Grid.prototype.destroyEvents.apply(this, arguments); // calls the super-method
+	unrenderEvents: function() {
+		this.removeSegPopover(); // removes the "more.." events popover
+		Grid.prototype.unrenderEvents.apply(this, arguments); // calls the super-method
 	},
 
 
@@ -55,7 +55,7 @@ DayGrid.mixin({
 
 
 	// Unrenders all currently rendered foreground event segments
-	destroyFgSegs: function() {
+	unrenderFgSegs: function() {
 		var rowStructs = this.rowStructs || [];
 		var rowStruct;
 

+ 9 - 9
src/common/DayGrid.js

@@ -51,8 +51,8 @@ var DayGrid = Grid.extend({
 	},
 
 
-	destroyDates: function() {
-		this.destroySegPopover();
+	unrenderDates: function() {
+		this.removeSegPopover();
 	},
 
 
@@ -337,9 +337,9 @@ var DayGrid = Grid.extend({
 
 
 	// Unrenders any visual indication of a hovering event
-	destroyDrag: function() {
-		this.destroyHighlight();
-		this.destroyHelper();
+	unrenderDrag: function() {
+		this.unrenderHighlight();
+		this.unrenderHelper();
 	},
 
 
@@ -355,9 +355,9 @@ var DayGrid = Grid.extend({
 
 
 	// Unrenders a visual indication of an event being resized
-	destroyEventResize: function() {
-		this.destroyHighlight();
-		this.destroyHelper();
+	unrenderEventResize: function() {
+		this.unrenderHighlight();
+		this.unrenderHelper();
 	},
 
 
@@ -401,7 +401,7 @@ var DayGrid = Grid.extend({
 
 
 	// Unrenders any visual indication of a mock helper event
-	destroyHelper: function() {
+	unrenderHelper: function() {
 		if (this.helperEls) {
 			this.helperEls.remove();
 			this.helperEls = null;

+ 4 - 4
src/common/DayGrid.limit.js

@@ -9,9 +9,9 @@ DayGrid.mixin({
 	popoverSegs: null, // an array of segment objects that the segPopover holds. null when not visible
 
 
-	destroySegPopover: function() {
+	removeSegPopover: function() {
 		if (this.segPopover) {
-			this.segPopover.hide(); // will trigger destruction of `segPopover` and `popoverSegs`
+			this.segPopover.hide(); // in handler, will call segPopover's removeElement
 		}
 	},
 
@@ -246,8 +246,8 @@ DayGrid.mixin({
 			autoHide: true, // when the user clicks elsewhere, hide the popover
 			viewportConstrain: view.opt('popoverViewportConstrain'),
 			hide: function() {
-				// destroy everything when the popover is hidden
-				_this.segPopover.destroy();
+				// kill everything when the popover is hidden
+				_this.segPopover.removeElement();
 				_this.segPopover = null;
 				_this.popoverSegs = null;
 			}

+ 13 - 13
src/common/Grid.events.js

@@ -39,11 +39,11 @@ Grid.mixin({
 
 
 	// Unrenders all events currently rendered on the grid
-	destroyEvents: function() {
+	unrenderEvents: function() {
 		this.triggerSegMouseout(); // trigger an eventMouseout if user's mouse is over an event
 
-		this.destroyFgSegs();
-		this.destroyBgSegs();
+		this.unrenderFgSegs();
+		this.unrenderBgSegs();
 
 		this.segs = null;
 	},
@@ -66,7 +66,7 @@ Grid.mixin({
 
 
 	// Unrenders all currently rendered foreground segments
-	destroyFgSegs: function() {
+	unrenderFgSegs: function() {
 		// subclasses must implement
 	},
 
@@ -123,8 +123,8 @@ Grid.mixin({
 
 
 	// Unrenders all the currently rendered background event segments
-	destroyBgSegs: function() {
-		this.destroyFill('bgEvent');
+	unrenderBgSegs: function() {
+		this.unrenderFill('bgEvent');
 	},
 
 
@@ -304,7 +304,7 @@ Grid.mixin({
 				}
 			},
 			cellOut: function() { // called before mouse moves to a different cell OR moved out of all cells
-				view.destroyDrag(); // unrender whatever was done in renderDrag
+				view.unrenderDrag(); // unrender whatever was done in renderDrag
 				mouseFollower.show(); // show in case we are moving out of all cells
 				dropLocation = null;
 			},
@@ -314,7 +314,7 @@ Grid.mixin({
 			dragStop: function(ev) {
 				// do revert animation if hasn't changed. calls a callback when finished (whether animation or not)
 				mouseFollower.stop(!dropLocation, function() {
-					view.destroyDrag();
+					view.unrenderDrag();
 					view.showEvent(event);
 					_this.segDragStop(seg, ev);
 
@@ -458,11 +458,11 @@ Grid.mixin({
 			},
 			cellOut: function() {
 				dropLocation = null; // signal unsuccessful
-				_this.destroyDrag();
+				_this.unrenderDrag();
 				enableCursor();
 			},
 			dragStop: function() {
-				_this.destroyDrag();
+				_this.unrenderDrag();
 				enableCursor();
 
 				if (dropLocation) { // element was dropped on a valid date/time cell
@@ -519,7 +519,7 @@ Grid.mixin({
 
 
 	// Unrenders a visual indication of an event or external element being dragged
-	destroyDrag: function() {
+	unrenderDrag: function() {
 		// subclasses must implement
 	},
 
@@ -574,7 +574,7 @@ Grid.mixin({
 				resizeLocation = null;
 			},
 			cellDone: function() { // resets the rendering to show the original event
-				_this.destroyEventResize();
+				_this.unrenderEventResize();
 				view.showEvent(event);
 				enableCursor();
 			},
@@ -673,7 +673,7 @@ Grid.mixin({
 
 
 	// Unrenders a visual indication of an event being resized.
-	destroyEventResize: function() {
+	unrenderEventResize: function() {
 		// subclasses must implement
 	},
 

+ 9 - 9
src/common/Grid.js

@@ -290,7 +290,7 @@ var Grid = fc.Grid = RowRenderer.extend({
 
 
 	// Removes the grid's container element from the DOM. Undoes any other DOM-related attachments.
-	// DOES NOT remove any content before hand (doens't clear events or call destroyDates), unlike View
+	// DOES NOT remove any content beforehand (doesn't clear events or call unrenderDates), unlike View
 	removeElement: function() {
 		this.unbindGlobalHandlers();
 
@@ -314,7 +314,7 @@ var Grid = fc.Grid = RowRenderer.extend({
 
 
 	// Unrenders the grid's date-related content
-	destroyDates: function() {
+	unrenderDates: function() {
 		// subclasses should implement
 	},
 
@@ -369,7 +369,7 @@ var Grid = fc.Grid = RowRenderer.extend({
 			cellOut: function(cell) {
 				dayClickCell = null;
 				selectionRange = null;
-				_this.destroySelection();
+				_this.unrenderSelection();
 				enableCursor();
 			},
 			listenStop: function(ev) {
@@ -431,7 +431,7 @@ var Grid = fc.Grid = RowRenderer.extend({
 
 
 	// Unrenders a mock event
-	destroyHelper: function() {
+	unrenderHelper: function() {
 		// subclasses must implement
 	},
 
@@ -447,8 +447,8 @@ var Grid = fc.Grid = RowRenderer.extend({
 
 
 	// Unrenders any visual indications of a selection. Will unrender a highlight by default.
-	destroySelection: function() {
-		this.destroyHighlight();
+	unrenderSelection: function() {
+		this.unrenderHighlight();
 	},
 
 
@@ -495,8 +495,8 @@ var Grid = fc.Grid = RowRenderer.extend({
 
 
 	// Unrenders the emphasis on a date range
-	destroyHighlight: function() {
-		this.destroyFill('highlight');
+	unrenderHighlight: function() {
+		this.unrenderFill('highlight');
 	},
 
 
@@ -519,7 +519,7 @@ var Grid = fc.Grid = RowRenderer.extend({
 
 
 	// Unrenders a specific type of fill that is currently rendered on the grid
-	destroyFill: function(type) {
+	unrenderFill: function(type) {
 		var el = this.elsByFill[type];
 
 		if (el) {

+ 2 - 2
src/common/MouseFollower.js

@@ -62,7 +62,7 @@ var MouseFollower = Class.extend({
 
 		function complete() {
 			this.isAnimating = false;
-			_this.destroyEl();
+			_this.removeElement();
 
 			this.top0 = this.left0 = null; // reset state for future updatePosition calls
 
@@ -120,7 +120,7 @@ var MouseFollower = Class.extend({
 
 
 	// Removes the tracking element if it has already been created
-	destroyEl: function() {
+	removeElement: function() {
 		if (this.el) {
 			this.el.remove();
 			this.el = null;

+ 1 - 1
src/common/Popover.js

@@ -87,7 +87,7 @@ var Popover = Class.extend({
 
 
 	// Hides and unregisters any handlers
-	destroy: function() {
+	removeElement: function() {
 		this.hide();
 
 		if (this.el) {

+ 1 - 1
src/common/TimeGrid.events.js

@@ -21,7 +21,7 @@ TimeGrid.mixin({
 
 
 	// Unrenders all currently rendered foreground event segments
-	destroyFgSegs: function(segs) {
+	unrenderFgSegs: function(segs) {
 		if (this.eventSkeletonEl) {
 			this.eventSkeletonEl.remove();
 			this.eventSkeletonEl = null;

+ 9 - 9
src/common/TimeGrid.js

@@ -354,9 +354,9 @@ var TimeGrid = Grid.extend({
 
 
 	// Unrenders any visual indication of an event being dragged
-	destroyDrag: function() {
-		this.destroyHelper();
-		this.destroyHighlight();
+	unrenderDrag: function() {
+		this.unrenderHelper();
+		this.unrenderHighlight();
 	},
 
 
@@ -371,8 +371,8 @@ var TimeGrid = Grid.extend({
 
 
 	// Unrenders any visual indication of an event being resized
-	destroyEventResize: function() {
-		this.destroyHelper();
+	unrenderEventResize: function() {
+		this.unrenderHelper();
 	},
 
 
@@ -411,7 +411,7 @@ var TimeGrid = Grid.extend({
 
 
 	// Unrenders any mock helper event
-	destroyHelper: function() {
+	unrenderHelper: function() {
 		if (this.helperEl) {
 			this.helperEl.remove();
 			this.helperEl = null;
@@ -435,9 +435,9 @@ var TimeGrid = Grid.extend({
 
 
 	// Unrenders any visual indication of a selection
-	destroySelection: function() {
-		this.destroyHelper();
-		this.destroyHighlight();
+	unrenderSelection: function() {
+		this.unrenderHelper();
+		this.unrenderHighlight();
 	},
 
 

+ 17 - 16
src/common/View.js

@@ -248,7 +248,7 @@ var View = fc.View = Class.extend({
 
 		// clean up the skeleton
 		if (this.isSkeletonRendered) {
-			this.destroySkeleton();
+			this.unrenderSkeleton();
 			this.isSkeletonRendered = false;
 		}
 
@@ -257,7 +257,8 @@ var View = fc.View = Class.extend({
 		this.el.remove();
 
 		// NOTE: don't null-out this.el in case the View was destroyed within an API callback.
-		// We don't null-out the View's other jQuery element references upon destroy, so why should we kill this.el?
+		// We don't null-out the View's other jQuery element references upon destroy,
+		//  so we shouldn't kill this.el either.
 	},
 
 
@@ -325,9 +326,9 @@ var View = fc.View = Class.extend({
 	// Can be asynchronous and return a promise.
 	clearView: function() {
 		this.unselect();
-		this.triggerDestroy();
-		this.destroyBusinessHours();
-		this.destroyDates();
+		this.triggerUnrender();
+		this.unrenderBusinessHours();
+		this.unrenderDates();
 		if (this.destroy) {
 			this.destroy(); // TODO: deprecate
 		}
@@ -341,7 +342,7 @@ var View = fc.View = Class.extend({
 
 
 	// Unrenders the basic structure of the view
-	destroySkeleton: function() {
+	unrenderSkeleton: function() {
 		// subclasses should implement
 	},
 
@@ -354,7 +355,7 @@ var View = fc.View = Class.extend({
 
 
 	// Unrenders the view's date-related content
-	destroyDates: function() {
+	unrenderDates: function() {
 		// subclasses should override
 	},
 
@@ -366,7 +367,7 @@ var View = fc.View = Class.extend({
 
 
 	// Unrenders previously-rendered business-hours
-	destroyBusinessHours: function() {
+	unrenderBusinessHours: function() {
 		// subclasses should implement
 	},
 
@@ -378,7 +379,7 @@ var View = fc.View = Class.extend({
 
 
 	// Signals that the view's content is about to be unrendered
-	triggerDestroy: function() {
+	triggerUnrender: function() {
 		this.trigger('viewDestroy', this, this, this.el);
 	},
 
@@ -528,8 +529,8 @@ var View = fc.View = Class.extend({
 	// Does everything necessary to clear the view's currently-rendered events
 	clearEvents: function() {
 		if (this.isEventsRendered) {
-			this.triggerEventDestroy();
-			this.destroyEvents();
+			this.triggerEventUnrender();
+			this.unrenderEvents();
 			this.isEventsRendered = false;
 		}
 	},
@@ -542,7 +543,7 @@ var View = fc.View = Class.extend({
 
 
 	// Removes event elements from the view.
-	destroyEvents: function() {
+	unrenderEvents: function() {
 		// subclasses should implement
 	},
 
@@ -557,7 +558,7 @@ var View = fc.View = Class.extend({
 
 
 	// Signals that all event elements are about to be removed
-	triggerEventDestroy: function() {
+	triggerEventUnrender: function() {
 		this.renderedEventSegEach(function(seg) {
 			this.trigger('eventDestroy', seg.event, seg.event, seg.el);
 		});
@@ -706,7 +707,7 @@ var View = fc.View = Class.extend({
 
 
 	// Unrenders a visual indication of an event or external-element being dragged.
-	destroyDrag: function() {
+	unrenderDrag: function() {
 		// subclasses must implement
 	},
 
@@ -793,14 +794,14 @@ var View = fc.View = Class.extend({
 	unselect: function(ev) {
 		if (this.isSelected) {
 			this.isSelected = false;
-			this.destroySelection();
+			this.unrenderSelection();
 			this.trigger('unselect', null, ev);
 		}
 	},
 
 
 	// Unrenders a visual indication of selection
-	destroySelection: function() {
+	unrenderSelection: function() {
 		// subclasses should implement
 	},