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() { function clearEvents() {
$.each(view.eventElements, function() { // TODO: move away from this, empty a container instead daySegmentContainer.empty();
this.remove(); slotSegmentContainer.empty();
});
view._clearEvents(); // only clears the hashes view._clearEvents(); // only clears the hashes
} }
@ -892,7 +891,7 @@ function Agenda(element, options, methods) {
td = tr.find('td'), td = tr.find('td'),
innerDiv = td.find('div'); innerDiv = td.find('div');
return Math.max(0, Math.round( 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') innerDiv = td.find('div.fc-day-content div')
.css('position', 'relative') .css('position', 'relative')
.height(''); // this is needed for IE7 to get an accurate position .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; rowContentHeight = 0;
for (j=0; j<levels.length; j++) { for (j=0; j<levels.length; j++) {
segs = levels[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" ]; var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
function getWH() { function getWH() {
val = name == "width" ? getElmOffsetWidth2(elem) : getElmOffsetHeight(elem); val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
if ( extra === "border" ) if ( extra === "border" )
return; return;
@ -767,7 +767,7 @@ jQuery.extend({
}); });
} }
if ( getElmOffsetWidth1(elem) !== 0 ) if ( elem.offsetWidth !== 0 )
getWH(); getWH();
else else
jQuery.swap( elem, props, getWH ); 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; var topBug;
function topCorrect(tr, td) { function topCorrect(tr) { // tr/th/td or anything else
if (topBug !== false && tr.is('tr')) { if (topBug !== false) {
var tbody = tr.parent(), var cell;
trTop = tr.position().top; if (tr.is('th,td')) {
if (topBug == undefined) { tr = (cell = tr).parent();
topBug = trTop != tr.children().position().top; }
if (topBug == undefined && tr.is('tr')) {
topBug = tr.position().top != tr.children().position().top;
} }
if (topBug) { 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; return 0;