more bugfixes for 1.4

This commit is contained in:
Adam Shaw
2009-11-22 16:21:13 -08:00
parent 9db94207cb
commit 0cf59ac85c
7 changed files with 132 additions and 128 deletions
+42 -1
View File
@@ -270,6 +270,29 @@ function setOuterHeight(element, height, includeMargins) {
/* Position Calculation
-----------------------------------------------------------------------------*/
// nasty bugs in opera 9.25
// position() returning relative to direct parent
var operaPositionBug;
function reportTBody(tbody) {
if (operaPositionBug == undefined) {
operaPositionBug = tbody.position().top != tbody.find('tr').position().top;
}
}
function safePosition(element, td, tr, tbody) {
var position = element.position();
if (operaPositionBug) {
position.top += tbody.position().top + tr.position().top - td.position().top;
}
return position;
}
/* Hover Matrix
-----------------------------------------------------------------------------*/
@@ -282,7 +305,9 @@ function HoverMatrix(changeCallback) {
this.row = function(e, topBug) {
prevRowE = $(e);
tops.push(prevRowE.offset().top + (topBug ? prevRowE.parent().position().top : 0));
tops.push(prevRowE.offset().top + (
(operaPositionBug && prevRowE.is('tr')) ? prevRowE.parent().position().top : 0
));
};
this.col = function(e) {
@@ -341,3 +366,19 @@ function zeroPad(n) {
return (n < 10 ? '0' : '') + n;
}
function smartProperty(obj, name) { // get a camel-cased/namespaced property
if (obj[name] != undefined) {
return obj[name];
}
var parts = name.split(/(?=[A-Z])/),
i=parts.length-1, res;
for (; i>=0; i--) {
res = obj[parts[i].toLowerCase()];
if (res != undefined) {
return res;
}
}
return obj[''];
}