Skip to content

Commit ebfe4e1

Browse files
committed
Update ResizeSensor.js
Fixed as was not working on Firefox 37.0.1. Was giving TypeError, window.getComputedStyle is null
1 parent bd02a96 commit ebfe4e1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/ResizeSensor.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,13 @@
4141
function getComputedStyle(element, prop) {
4242
if (element.currentStyle) {
4343
return element.currentStyle[prop];
44-
} else if (window.getComputedStyle) {
45-
return window.getComputedStyle(element, null).getPropertyValue(prop);
44+
} else if (window.getComputedStyle != null) {
45+
var tmpStyle = window.getComputedStyle(element, null);
46+
if (tmpStyle != null) {
47+
return tmpStyle.getPropertyValue(prop);
48+
} else {
49+
return element.style[prop];
50+
}
4651
} else {
4752
return element.style[prop];
4853
}
@@ -155,4 +160,4 @@
155160
}
156161
};
157162

158-
})();
163+
})();

0 commit comments

Comments
 (0)