aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/css.js5
-rw-r--r--test/unit/css.js6
2 files changed, 10 insertions, 1 deletions
diff --git a/src/css.js b/src/css.js
index 4858338ba..9154dab76 100644
--- a/src/css.js
+++ b/src/css.js
@@ -16,6 +16,7 @@ var ralpha = /alpha\([^)]*\)/i,
cssExpand = jQuery.cssExpand,
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
+ rposition = /^(top|right|bottom|left)$/,
curCSS;
@@ -242,7 +243,9 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) {
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
- if ( rnumnonpx.test( ret ) ) {
+ // but not position css attributes, as those are proportional to the parent element instead
+ // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
+ if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values
left = style.left;
diff --git a/test/unit/css.js b/test/unit/css.js
index a7d16bd5a..ac531f1e0 100644
--- a/test/unit/css.js
+++ b/test/unit/css.js
@@ -538,6 +538,12 @@ test("can't get background-position in IE<9, see #10796", function() {
}
});
+test("percentage position properties in IE<9 should not be incorrectly transformed to pixels, see #11311", function() {
+ expect( 1 );
+ var div = jQuery("<div style='position: absolute; width: 1px; height: 20px; bottom:50%;'></div>").appendTo( "#qunit-fixture" );
+ ok( window.getComputedStyle || div.css( "bottom" ) === "50%", "position properties get incorrectly transformed in IE<8, see #11311" );
+});
+
test("Do not append px to 'fill-opacity' #9548", 1, function() {
var $div = jQuery("<div>").appendTo("#qunit-fixture");