aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimmy Willison <4timmywil@gmail.com>2017-03-20 13:42:07 -0400
committerTimmy Willison <4timmywil@gmail.com>2017-03-20 13:43:18 -0400
commitc4598da4293afa4bb9c0425d964432e918055aa6 (patch)
treef4d8642de8be060c8da0beec3f2323593d320115
parent066bd8681c4a8ba2de707d59ee3a8df771804970 (diff)
downloadjquery-c4598da4293afa4bb9c0425d964432e918055aa6.tar.gz
jquery-c4598da4293afa4bb9c0425d964432e918055aa6.zip
CSS: retrieve inline style before computed
- Fixes an issue with getting computed style on detached elements
-rw-r--r--src/css/curCSS.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/css/curCSS.js b/src/css/curCSS.js
index e44551a47..01ccad3ae 100644
--- a/src/css/curCSS.js
+++ b/src/css/curCSS.js
@@ -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;