Skip to content

Commit

Permalink
CSS: Fix the pixelMarginRight support test in Android 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mgol committed Feb 5, 2015
1 parent 3747cc6 commit cdfc2d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 0 additions & 6 deletions src/css/curCSS.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ function curCSS( elem, name, computed ) {
ret = jQuery.style( elem, name );
}

// Support: Android 4.0-4.3
// A tribute to the "awesome hack by Dean Edwards"
// Android Browser returns percentage for some values,
// but width seems to be reliably pixels.
// This is against the CSSOM draft spec:
// http://dev.w3.org/csswg/cssom/#resolved-values
if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {

// Remember the original values
Expand Down
9 changes: 8 additions & 1 deletion src/css/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,15 @@ define([
return boxSizingReliableVal;
},
pixelMarginRight: function() {
// Support: Android 4.0-4.3
// A tribute to the "awesome hack by Dean Edwards"
// Android Browser returns percentage for some values,
// but width seems to be reliably pixels.
// This is against the CSSOM draft spec:
// http://dev.w3.org/csswg/cssom/#resolved-values
if ( pixelMarginRightVal == null ) {
div.style.cssText = "display:block;width:50%;margin-right:50%";
div.style.cssText = "display:block;width:50%;border:0;margin:0;padding:0;" +
"margin-right:50%";
documentElement.appendChild( container );
pixelMarginRightVal =
window.getComputedStyle( div, null ).marginRight === "4px";
Expand Down

0 comments on commit cdfc2d0

Please sign in to comment.