ソースを参照

optimize a loop

Adam Shaw 11 年 前
コミット
cabddee740
1 ファイル変更5 行追加5 行削除
  1. 5 5
      src/common/DayGrid.limit.js

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

@@ -53,18 +53,18 @@ DayGrid.mixin({
 		var i, trEl;
 		var i, trEl;
 		var trHeight;
 		var trHeight;
 
 
+		function iterInnerHeights(i, childNode) {
+			trHeight = Math.max(trHeight, $(childNode).outerHeight());
+		}
+
 		// Reveal one level <tr> at a time and stop when we find one out of bounds
 		// Reveal one level <tr> at a time and stop when we find one out of bounds
 		for (i = 0; i < trEls.length; i++) {
 		for (i = 0; i < trEls.length; i++) {
 			trEl = trEls.eq(i).removeClass('fc-limited'); // reset to original state (reveal)
 			trEl = trEls.eq(i).removeClass('fc-limited'); // reset to original state (reveal)
 
 
 			// with rowspans>1 and IE8, trEl.outerHeight() would return the height of the largest cell,
 			// with rowspans>1 and IE8, trEl.outerHeight() would return the height of the largest cell,
 			// so instead, find the tallest inner content element.
 			// so instead, find the tallest inner content element.
-			/*jshint -W083 */
 			trHeight = 0;
 			trHeight = 0;
-			trEl.find('> td > :first-child').each(function(i, childNode) {
-				trHeight = Math.max(trHeight, $(childNode).outerHeight());
-			});
-			/*jshint +W083 */
+			trEl.find('> td > :first-child').each(iterInnerHeights);
 
 
 			if (trEl.position().top + trHeight > rowHeight) {
 			if (trEl.position().top + trHeight > rowHeight) {
 				return i;
 				return i;