some helper methods

This commit is contained in:
Fabian Jakobs 2010-04-06 17:51:52 +02:00
commit 08f14e321f

29
lib.js
View file

@ -45,4 +45,31 @@ inherits = function (ctor, superCtor) {
ctor.super_ = superCtor.prototype;
ctor.prototype = new tempCtor();
ctor.prototype.constructor = ctor;
};
};
getInnerWidth = function(element)
{
return (
parseInt(computedStyle(element, "paddingLeft")) +
parseInt(computedStyle(element, "paddingRight")) +
element.clientWidth
);
};
getInnerHeight = function(element)
{
return (
parseInt(computedStyle(element, "paddingTop")) +
parseInt(computedStyle(element, "paddingBottom")) +
element.clientHeight
);
};
computedStyle = function(element, style)
{
if (window.getComputedStyle) {
return (window.getComputedStyle(element, null))[style];
} else {
return element.currentStyle[style];
}
}