tweaks, opera bugfix, optimized clearEvents

This commit is contained in:
Adam Shaw 2010-01-25 23:05:57 -08:00
parent a00104b10b
commit f89e82da68
4 changed files with 15 additions and 27 deletions

View file

@ -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)
));
}

View file

@ -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];

View file

@ -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;
}

View file

@ -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;