Skip to content

Commit

Permalink
CSS: dimensions workaround for IE11 fullscreen quirk
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Naumann committed Jun 17, 2015
1 parent b041242 commit 03a3335
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ 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 https://github.com/jquery/jquery/issues/1764
if ( !support.reliableDimensionsInFullscreenMode && window.top !== window.self &&
document.msFullscreenElement ) {
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
7 changes: 6 additions & 1 deletion src/css/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ define([
div.removeChild( marginDiv );

return ret;
}
},
// Support: IE 11
// IE 11 has a bug with offsetWidth / offsetHeight / getClientBoundingRect()
// in fullscreen mode inside an iframe the values are 100x smaller than they should be
// See https://connect.microsoft.com/IE/feedback/details/838286/ie-11-incorrectly-reports-dom-element-sizes-in-fullscreen-mode-when-fullscreened-element-is-within-an-iframe
reliableDimensionsInFullscreenMode: !( "msFullscreenElement" in document )
});
})();

Expand Down

0 comments on commit 03a3335

Please sign in to comment.