From 6da36c7bdfb93903129e9bfa0e1f43984e134503 Mon Sep 17 00:00:00 2001 From: Clemens Date: Thu, 7 Jun 2012 16:27:45 +0200 Subject: [PATCH] small performance-fix for minute-scaled slots --- src/agenda/AgendaView.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/agenda/AgendaView.js b/src/agenda/AgendaView.js index b7b0b24..c83971b 100644 --- a/src/agenda/AgendaView.js +++ b/src/agenda/AgendaView.js @@ -722,7 +722,11 @@ function AgendaView(element, calendar, viewName) { slotI = Math.floor(minutes / slotMinutes), slotTop = slotTopCache[slotI]; if (slotTop === undefined) { - slotTop = slotTopCache[slotI] = slotTable.find('tr:eq(' + slotI + ') td div')[0].offsetTop; //.position().top; // need this optimization??? + slotTop = slotTopCache[slotI] = + slotTable.find('tr').eq(slotI).find('td div')[0].offsetTop; + // .eq() is faster than ":eq()" selector + // [0].offsetTop is faster than .position().top (do we really need this optimization?) + // a better optimization would be to cache all these divs } return Math.max(0, Math.round( slotTop - 1 + slotHeight * ((minutes % slotMinutes) / slotMinutes)