From d3a40aedf386dc5a6d577f831329052074494e9b Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Thu, 15 Oct 2015 22:13:57 -0500 Subject: [PATCH] fix(dom): remove use of element.prop() Closes #288 --- ionic/util/dom.ts | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/ionic/util/dom.ts b/ionic/util/dom.ts index 0adecf1180..868acf89fd 100644 --- a/ionic/util/dom.ts +++ b/ionic/util/dom.ts @@ -273,18 +273,8 @@ export function flushDimensionCache() { let dimensionCache = {}; let dimensionIds = 0; -function getStyle(el, cssprop) { - if (el.currentStyle) { //IE - return el.currentStyle[cssprop]; - } else if (window.getComputedStyle) { - return window.getComputedStyle(el)[cssprop]; - } - // finally try and get inline style - return el.style[cssprop]; -} - function isStaticPositioned(element) { - return (getStyle(element, 'position') || 'static') === 'static'; + return (element.style.position || 'static') === 'static'; } /** @@ -317,8 +307,8 @@ export function position(element) { var boundingClientRect = element.getBoundingClientRect(); return { - width: boundingClientRect.width || element.prop('offsetWidth'), - height: boundingClientRect.height || element.prop('offsetHeight'), + width: boundingClientRect.width || element.offsetWidth, + height: boundingClientRect.height || element.offsetHeight, top: elBCR.top - offsetParentBCR.top, left: elBCR.left - offsetParentBCR.left }; @@ -333,8 +323,8 @@ export function position(element) { export function offset(element) { var boundingClientRect = element.getBoundingClientRect(); return { - width: boundingClientRect.width || element.prop('offsetWidth'), - height: boundingClientRect.height || element.prop('offsetHeight'), + width: boundingClientRect.width || element.offsetWidth, + height: boundingClientRect.height || element.offsetHeight, top: boundingClientRect.top + (window.pageYOffset || document.documentElement.scrollTop), left: boundingClientRect.left + (window.pageXOffset || document.documentElement.scrollLeft) };