ソースを参照

fix some IE8 problems

Adam Shaw 11 年 前
コミット
697c576285
4 ファイル変更34 行追加30 行削除
  1. 17 15
      src/agenda/AgendaView.js
  2. 14 14
      src/basic/BasicView.js
  3. 2 0
      src/common/MouseFollower.js
  4. 1 1
      src/common/TimeGrid.js

+ 17 - 15
src/agenda/AgendaView.js

@@ -166,19 +166,14 @@ $.extend(AgendaView.prototype, {
 			}
 
 			return '' +
-				'<th class="fc-axis fc-week-number ' + this.widgetHeaderClass + '">' +
+				'<th class="fc-axis fc-week-number ' + this.widgetHeaderClass + '" ' + this.axisStyleAttr() + '>' +
 					'<span>' + // needed for matchCellWidths
 						htmlEscape(weekText) +
 					'</span>' +
 				'</th>';
 		}
 		else {
-			return '<th class="fc-axis ' + this.widgetHeaderClass + '"' +
-				(this.axisWidth !== null ?
-					' style="width:' + this.axisWidth + 'px"' :
-					''
-					) +
-				'></th>';
+			return '<th class="fc-axis ' + this.widgetHeaderClass + '" ' + this.axisStyleAttr() + '></th>';
 		}
 	},
 
@@ -187,7 +182,7 @@ $.extend(AgendaView.prototype, {
 	// Queried by the DayGrid subcomponent when generating rows. Ordering depends on isRTL.
 	dayIntroHtml: function() {
 		return '' +
-			'<td class="' + this.widgetHeaderClass + ' fc-axis">' +
+			'<td class="' + this.widgetHeaderClass + ' fc-axis" ' + this.axisStyleAttr() + '>' +
 				'<span>' + // needed for matchCellWidths
 					(this.opt('allDayHTML') || htmlEscape(this.opt('allDayText'))) +
 				'</span>' +
@@ -199,12 +194,16 @@ $.extend(AgendaView.prototype, {
 	// Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid.
 	// Queried by the TimeGrid and DayGrid subcomponents when generating rows. Ordering depends on isRTL.
 	introHtml: function() {
-		return '<td class="fc-axis"' +
-			(this.axisWidth !== null ?
-				' style="width:' + this.axisWidth + 'px"' :
-				''
-				) +
-			'></td>';
+		return '<td class="fc-axis" ' + this.axisStyleAttr() + '></td>';
+	},
+
+
+	// Generates an HTML attribute string for setting the width of the axis, if it is known
+	axisStyleAttr: function() {
+		if (this.axisWidth !== null) {
+			 return 'style="width:' + this.axisWidth + 'px"';
+		}
+		return '';
 	},
 
 
@@ -337,7 +336,10 @@ $.extend(AgendaView.prototype, {
 			this.dayGrid.destroyEvents();
 		}
 
-		this.updateHeight();
+		// When rerendering events in IE8, the event elements flash because of this line.
+		// Comment it out. It's not necessary because a renderEvents is always called subsequently,
+		// which updates the height.
+		//this.updateHeight();
 
 		View.prototype.destroyEvents.call(this); // call the super-method. will kill `this.segs`
 	},

+ 14 - 14
src/basic/BasicView.js

@@ -80,7 +80,7 @@ $.extend(BasicView.prototype, {
 	headIntroHtml: function() {
 		if (this.weekNumbersVisible) {
 			return '' +
-				'<th class="fc-week-number ' + this.widgetHeaderClass + '">' +
+				'<th class="fc-week-number ' + this.widgetHeaderClass + '" ' + this.weekNumberStyleAttr() + '>' +
 					'<span>' + // needed for matchCellWidths
 						htmlEscape(this.opt('weekNumberTitle')) +
 					'</span>' +
@@ -94,7 +94,7 @@ $.extend(BasicView.prototype, {
 	numberIntroHtml: function(row) {
 		if (this.weekNumbersVisible) {
 			return '' +
-				'<td class="fc-week-number">' +
+				'<td class="fc-week-number" ' + this.weekNumberStyleAttr() + '>' +
 					'<span>' + // needed for matchCellWidths
 						this.calendar.calculateWeekNumber(this.cellToDate(row, 0)) +
 					'</span>' +
@@ -107,12 +107,8 @@ $.extend(BasicView.prototype, {
 	// Queried by the DayGrid subcomponent. Ordering depends on isRTL.
 	dayIntroHtml: function() {
 		if (this.weekNumbersVisible) {
-			return '<td class="fc-week-number ' + this.widgetContentClass + '"' +
-				(this.weekNumberWidth !== null ?
-					' style="width:' + this.weekNumberWidth + 'px"' :
-					''
-					) +
-				'></td>';
+			return '<td class="fc-week-number ' + this.widgetContentClass + '" ' +
+				this.weekNumberStyleAttr() + '></td>';
 		}
 	},
 
@@ -121,12 +117,7 @@ $.extend(BasicView.prototype, {
 	// Affects helper-skeleton and highlight-skeleton rows.
 	introHtml: function() {
 		if (this.weekNumbersVisible) {
-			return '<td class="fc-week-number"' +
-				(this.weekNumberWidth !== null ?
-					' style="width:' + this.weekNumberWidth + 'px"' :
-					''
-					) +
-				'></td>';
+			return '<td class="fc-week-number" ' + this.weekNumberStyleAttr() + '></td>';
 		}
 	},
 
@@ -150,6 +141,15 @@ $.extend(BasicView.prototype, {
 	},
 
 
+	// Generates an HTML attribute string for setting the width of the week number column, if it is known
+	weekNumberStyleAttr: function() {
+		if (this.weekNumberWidth !== null) {
+			return 'style="width:' + this.weekNumberWidth + 'px"';
+		}
+		return '';
+	},
+
+
 	/* Dimensions
 	------------------------------------------------------------------------------------------------------------------*/
 

+ 2 - 0
src/common/MouseFollower.js

@@ -99,6 +99,7 @@ MouseFollower.prototype = {
 		var el = this.el;
 
 		if (!el) {
+			this.sourceEl.width(); // hack to force IE8 to compute correct bounding box
 			el = this.el = this.sourceEl.clone()
 				.css({
 					position: 'absolute',
@@ -137,6 +138,7 @@ MouseFollower.prototype = {
 
 		// make sure origin info was computed
 		if (this.top0 === null) {
+			this.sourceEl.width(); // hack to force IE8 to compute correct bounding box
 			sourceOffset = this.sourceEl.offset();
 			origin = this.el.offsetParent().offset();
 			this.top0 = sourceOffset.top - origin.top;

+ 1 - 1
src/common/TimeGrid.js

@@ -82,7 +82,7 @@ $.extend(TimeGrid.prototype, {
 			minutes = slotDate.minutes();
 
 			axisHtml =
-				'<td class="fc-axis fc-time ' + view.widgetHeaderClass + '">' +
+				'<td class="fc-axis fc-time ' + view.widgetHeaderClass + '" ' + view.axisStyleAttr() + '>' +
 					((!slotNormal || !minutes) ? // if irregular slot duration, or on the hour, then display the time
 						'<span>' + // for matchCellWidths
 							htmlEscape(calendar.formatDate(slotDate, view.opt('axisFormat'))) +