Skip to content

Commit fc69b37

Browse files
author
Martin Naumann
committed
CSS: dimensions workaround for IE11 fullscreen quirk
Fixes #1764
1 parent b041242 commit fc69b37

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/css.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ function getWidthOrHeight( elem, name, extra ) {
113113
styles = getStyles( elem ),
114114
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
115115

116+
// Support: IE11+
117+
// Fix for edge case in IE 11. See https://github.com/jquery/jquery/issues/1764
118+
if (support.reliableDimensionsInFullscreenMode && window.top !== window.self &&
119+
document.msFullscreenElement) {
120+
val = name === "width" ?
121+
Math.round(elem.getBoundingClientRect().width * 100) :
122+
Math.round(elem.getBoundingClientRect().height * 100);
123+
}
124+
116125
// Some non-html elements return undefined for offsetWidth, so check for null/undefined
117126
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
118127
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668

src/css/support.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ define([
9696
div.removeChild( marginDiv );
9797

9898
return ret;
99-
}
99+
},
100+
// Support: IE 11
101+
// IE 11 has a bug with offsetWidth / offsetHeight / getClientBoundingRect()
102+
// in fullscreen mode inside an iframe
103+
reliableDimensionsInFullscreenMode: !("msFullscreenElement" in document)
100104
});
101105
})();
102106

0 commit comments

Comments
 (0)