Closed FezVrasta closed 8 years ago
This breaks IE8, as its getBoundingClientRect() object does not return width and height properties. eq.js supports IE8 with the included polyfills, so I think this won't be merged unless a fallback to this method is added.
Couldn't find an easy drop-in polyfill, but here's an implementation that should work in older browsers: https://github.com/zeroclipboard/zeroclipboard/blob/be4573579f9dbccad4280bd06e2e72c896fa5c66/ZeroClipboard.js#L124-L155
As @jonscottclark said, as I'm trying to keep IE8 compatibility, can't use getBoundingClientRect
without a suitable polyfill available (and pulled in during the build process)
@FezVrasta your suggested polyfill is based on Object.defineProperties which seem to be supported from IE9+. Thus i dunno if the comment in the suggested snippet is correct.
As a solution to this, there is a polyfill for Object.defineProperties on the mozilla MDN.
The polyfill I linked seems to do what getBoundingClientRect
does within the browser, but man.. it's really long.
Why don't just do:
var rect = el.getBoundingClientRect();
var width = rect.width;
if (width === undefined) {
width = rect.right - rect.left;
}
Or something similar ?
I think it could work... well, obviously we'll still have the the problem fixed by this PR on IE8, but it's still an improvement.
closing in favor of #71
fixes #65