Forráskód Böngészése

tweaks, opera bugfix, optimized clearEvents

Adam Shaw 16 éve
szülő
commit
f89e82da68
4 módosított fájl, 15 hozzáadás és 27 törlés
  1. 3 4
      src/agenda.js
  2. 1 1
      src/grid.js
  3. 2 15
      src/jquery/jquery-uncompressed.js
  4. 9 7
      src/util.js

+ 3 - 4
src/agenda.js

@@ -371,9 +371,8 @@ function Agenda(element, options, methods) {
 	
 	
 	function clearEvents() {
-		$.each(view.eventElements, function() { // TODO: move away from this, empty a container instead
-			this.remove();
-		});
+		daySegmentContainer.empty();
+		slotSegmentContainer.empty();
 		view._clearEvents(); // only clears the hashes
 	}
 	
@@ -892,7 +891,7 @@ function Agenda(element, options, methods) {
 			td = tr.find('td'),
 			innerDiv = td.find('div');
 		return Math.max(0, Math.round(
-			innerDiv.position().top + topCorrect(tr, td) - 1 + slotHeight * ((minutes % slotMinutes) / slotMinutes)
+			innerDiv.position().top + topCorrect(td) - 1 + slotHeight * ((minutes % slotMinutes) / slotMinutes)
 		));
 	}
 	

+ 1 - 1
src/grid.js

@@ -604,7 +604,7 @@ function _renderDaySegs(segRows, view, minLeft, maxLeft, getTr, dayContentLeft,
 		innerDiv = td.find('div.fc-day-content div')
 			.css('position', 'relative')
 			.height(''); // this is needed for IE7 to get an accurate position
-		top = innerDiv.position().top + topCorrect(tr, td);
+		top = innerDiv.position().top + topCorrect(td);
 		rowContentHeight = 0;
 		for (j=0; j<levels.length; j++) {
 			segs = levels[j];

+ 2 - 15
src/jquery/jquery-uncompressed.js

@@ -752,7 +752,7 @@ jQuery.extend({
 			var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
 
 			function getWH() {
-				val = name == "width" ? getElmOffsetWidth2(elem) : getElmOffsetHeight(elem);
+				val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
 
 				if ( extra === "border" )
 					return;
@@ -767,7 +767,7 @@ jQuery.extend({
 				});
 			}
 
-			if ( getElmOffsetWidth1(elem) !== 0 )
+			if ( elem.offsetWidth !== 0 )
 				getWH();
 			else
 				jQuery.swap( elem, props, getWH );
@@ -4374,16 +4374,3 @@ jQuery.each([ "Height", "Width" ], function(i, name){
 
 });
 })();
-
-function getElmOffsetWidth1(e) {
-	return e.offsetWidth;
-}
-
-function getElmOffsetWidth2(e) {
-	return e.offsetWidth;
-}
-
-function getElmOffsetHeight(e) {
-	return e.offsetHeight;
-}
-

+ 9 - 7
src/util.js

@@ -340,15 +340,17 @@ function vsides(e, includeMargins) {
 
 var topBug;
 
-function topCorrect(tr, td) {
-	if (topBug !== false && tr.is('tr')) {
-		var tbody = tr.parent(),
-			trTop = tr.position().top;
-		if (topBug == undefined) {
-			topBug = trTop != tr.children().position().top;
+function topCorrect(tr) { // tr/th/td or anything else
+	if (topBug !== false) {
+		var cell;
+		if (tr.is('th,td')) {
+			tr = (cell = tr).parent();
+		}
+		if (topBug == undefined && tr.is('tr')) {
+			topBug = tr.position().top != tr.children().position().top;
 		}
 		if (topBug) {
-			return tbody.position().top + trTop - (td ? td.position().top : 0);
+			return tr.parent().position().top + (cell ? tr.position().top - cell.position().top : 0);
 		}
 	}
 	return 0;