fix(dom): remove use of element.prop()

Closes #288
This commit is contained in:
Adam Bradley
2015-10-15 22:13:57 -05:00
parent 52aa0548e7
commit d3a40aedf3

View File

@ -273,18 +273,8 @@ export function flushDimensionCache() {
let dimensionCache = {}; let dimensionCache = {};
let dimensionIds = 0; 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) { 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(); var boundingClientRect = element.getBoundingClientRect();
return { return {
width: boundingClientRect.width || element.prop('offsetWidth'), width: boundingClientRect.width || element.offsetWidth,
height: boundingClientRect.height || element.prop('offsetHeight'), height: boundingClientRect.height || element.offsetHeight,
top: elBCR.top - offsetParentBCR.top, top: elBCR.top - offsetParentBCR.top,
left: elBCR.left - offsetParentBCR.left left: elBCR.left - offsetParentBCR.left
}; };
@ -333,8 +323,8 @@ export function position(element) {
export function offset(element) { export function offset(element) {
var boundingClientRect = element.getBoundingClientRect(); var boundingClientRect = element.getBoundingClientRect();
return { return {
width: boundingClientRect.width || element.prop('offsetWidth'), width: boundingClientRect.width || element.offsetWidth,
height: boundingClientRect.height || element.prop('offsetHeight'), height: boundingClientRect.height || element.offsetHeight,
top: boundingClientRect.top + (window.pageYOffset || document.documentElement.scrollTop), top: boundingClientRect.top + (window.pageYOffset || document.documentElement.scrollTop),
left: boundingClientRect.left + (window.pageXOffset || document.documentElement.scrollLeft) left: boundingClientRect.left + (window.pageXOffset || document.documentElement.scrollLeft)
}; };