]> source.dussan.org Git - jquery.git/commitdiff
CSS: retrieve inline style before computed
authorTimmy Willison <4timmywil@gmail.com>
Mon, 20 Mar 2017 17:42:07 +0000 (13:42 -0400)
committerTimmy Willison <4timmywil@gmail.com>
Mon, 20 Mar 2017 17:43:18 +0000 (13:43 -0400)
- Fixes an issue with getting computed style on detached elements

src/css/curCSS.js

index e44551a47154ee51b10e2b38b01d843d9e8ffed4..01ccad3aec52301258ea6717802e2c53c2adb6d4 100644 (file)
@@ -10,7 +10,13 @@ define( [
 "use strict";
 
 function curCSS( elem, name, computed ) {
-       var width, minWidth, maxWidth, ret, style;
+       var width, minWidth, maxWidth, ret,
+
+               // Support: Firefox 51+
+               // Retrieving style before computed somehow
+               // fixes an issue with getting wrong values
+               // on detached elements
+               style = elem.style;
 
        computed = computed || getStyles( elem );
 
@@ -30,7 +36,6 @@ function curCSS( elem, name, computed ) {
                // This is against the CSSOM draft spec:
                // https://drafts.csswg.org/cssom/#resolved-values
                if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
-                       style = elem.style;
 
                        // Remember the original values
                        width = style.width;