some helper methods

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

27
lib.js
View file

@ -46,3 +46,30 @@ inherits = function (ctor, superCtor) {
ctor.prototype = new tempCtor(); ctor.prototype = new tempCtor();
ctor.prototype.constructor = ctor; 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];
}
}