Skip to content
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

Handle lack of .width and .height from getBoundingClientRect() in IE8 #14492

Merged
merged 1 commit into from
Sep 11, 2014

Conversation

cvrebert
Copy link
Collaborator

Closes #14093. Correction to #14090.
New relevant docs: https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect#Browser_compatibility
This takes the same approach as ZeroClipboard.
CC: @fat

@@ -324,6 +324,17 @@
var isSvg = window.SVGElement && el instanceof window.SVGElement

var elRect = el.getBoundingClientRect()
if (elRect.width == null) {
// width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
elRect = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IE8 doesn't let us add new properties to TextRectangle instances, so we have to make a whole new object (or use prototypes).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think something like elRect = $.extend({}, elRect, { width: … height …} would look a bit cleaner

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds slower, but, alrighty.

@cvrebert cvrebert force-pushed the ie8-getBoundingClientRect branch from eaf21ec to 989dafb Compare September 8, 2014 05:58
@cvrebert
Copy link
Collaborator Author

cvrebert commented Sep 8, 2014

@fat Okay, updated per your comment. LGTY?

hnrch02 added a commit that referenced this pull request Sep 11, 2014
Handle lack of .width and .height from getBoundingClientRect() in IE8
@hnrch02 hnrch02 merged commit 6e206f5 into master Sep 11, 2014
@hnrch02 hnrch02 deleted the ie8-getBoundingClientRect branch September 11, 2014 21:11
@cvrebert cvrebert mentioned this pull request Sep 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tooltip.js: getBoundingClientRect method existence check is unnecessary?
4 participants