Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ function getWidthOrHeight( elem, name, extra ) {
styles = getStyles( elem ),
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";

// Support: IE11
// Fix for edge case in IE 11. See gh-1764
if ( document.msFullscreenElement && window.top !== window ) {
// Support: IE11
// Running getBoundingClientRect on a
// disconnected node in IE throws an error
if ( elem.getClientRects().length ) {
Copy link
Member

Choose a reason for hiding this comment

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

To check if node is connected or not, we use jQuery.contains( elem.ownerDocument, elem ), perf would be interesting to see though

Copy link
Member

Choose a reason for hiding this comment

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

We seem to be inconsistent now, e.g.: 0e4477c.

We have to use jQuery.contains on compat, not necessarily on master.

Note that here we don't really care if the node is disconnected but we care for elem. getBoundingClientRect() to not throw. These situations are equivalent, though.

This code is restricted to one browser, anyway so whatever works in IE11 is fine.

Copy link
Member

Choose a reason for hiding this comment

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

Created #2404

Copy link
Member

Choose a reason for hiding this comment

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

@markelog Thanks. Since we have the issue now, I wouldn't block this PR over it.

val = Math.round( elem.getBoundingClientRect()[ name ] * 100 );
}
}

// Some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
Expand Down