-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IE 11 may throw an exception when calling getBoundingClientRect
on detached elements
#75
Comments
Rather then monkey patching the
Example: function getBoundingClientRect(element) {
try {
return element.getBoundingClientRect();
} catch(e) {
if (typoof e === 'object' && e !==nuill && /* check the e is the exception we expect */) {
return { top: 0, bottom: 0, left: 0, width: 0, height: 0, right: 0 };
} else {
throw e; // something else went wrong, and we must surface the error
}
} |
Yep totally agree. I spiked (we can rename) spanielGetBoundingClientRect which is near identical to what you proposed; testing and will push later. |
This PR should address this issue: #79 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
IE 11 may throw an exception when calling
.getBoundingClientRect
on detached elements. These elements should (according to CSSOM spec) return an object with zero for the top, bottom, left, right, width, and height properties.http://jsfiddle.net/jonathansampson/3vqddemh/ for the excellent solution to this.
The text was updated successfully, but these errors were encountered: