]> source.dussan.org Git - jquery.git/commitdiff
CSS: Work around an IE11 fullscreen dimensions bug
authorMartin Naumann <martin@geekonaut.de>
Tue, 16 Jun 2015 21:55:21 +0000 (23:55 +0200)
committerMichał Gołębiowski <m.goleb@gmail.com>
Mon, 22 Jun 2015 23:47:48 +0000 (01:47 +0200)
(cherry-picked from 90d828bad0d6d318d73d6cf6209d9dc7ac13878c)

Fixes gh-1764
Closes gh-2401

src/css.js

index 9a25816a4f09b2fd08676770f4fe136669413746..1ac2bc02cdcf225448df584afb38a2b92fe64fb9 100644 (file)
@@ -120,6 +120,17 @@ function getWidthOrHeight( elem, name, extra ) {
                styles = getStyles( elem ),
                isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
 
+       // Support: IE11 only
+       // Fix for edge case in IE 11. See gh-1764
+       if ( document.msFullscreenElement && window.top !== window ) {
+               // Support: IE11 only
+               // Running getBoundingClientRect on a disconnected node
+               // in IE throws an error.
+               if ( elem.getClientRects().length ) {
+                       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