Skip to content

Commit

Permalink
CSS: retrieve inline style before computed
Browse files Browse the repository at this point in the history
- Fixes an issue with getting computed style on detached elements
  • Loading branch information
timmywil committed Mar 20, 2017
1 parent 066bd86 commit c4598da
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/css/curCSS.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand All @@ -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;
Expand Down

0 comments on commit c4598da

Please sign in to comment.