Define DomElement.getComputedStyle()

This commit is contained in:
Jürg Lehni 2011-06-26 00:48:47 +02:00
parent fa29686202
commit ab524b7642

View file

@ -32,6 +32,18 @@ var DomElement = new function() {
}
return {
getWindow: function(doc) {
return doc.defaultView || doc.parentWindow;
},
getComputedStyle: function(el, name) {
if (el.currentStyle)
return el.currentStyle[Base.camelize(name)];
var style = DomElement.getWindow(el.ownerDocument).getComputedStyle(
el, null);
return style ? style.getPropertyValue(Base.hyphenate(name)) : null;
},
getOffset: function(el, positioned, scroll) {
var point = cumulate(el, 'offset', 'offsetParent', positioned);
return scroll