From ab524b764290ac0b50514536d3f66bb600e0ffa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 26 Jun 2011 00:48:47 +0200 Subject: [PATCH] Define DomElement.getComputedStyle() --- src/browser/DomElement.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/browser/DomElement.js b/src/browser/DomElement.js index cdc49146..8cf77907 100644 --- a/src/browser/DomElement.js +++ b/src/browser/DomElement.js @@ -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