diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2012-05-24 21:39:31 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-05-24 21:39:31 -0400 |
commit | d5e5ce5bd006ae94e9d85949b4f7141642cebf81 (patch) | |
tree | 5c5e42a54d3d9432ad27aa670473ec56892c6fc0 /src/css.js | |
parent | 04c06e6858caca13fd9cca71ce80a1fd431f2c41 (diff) | |
download | jquery-d5e5ce5bd006ae94e9d85949b4f7141642cebf81.tar.gz jquery-d5e5ce5bd006ae94e9d85949b4f7141642cebf81.zip |
Fix #11311. Percents not pixels for top/left/bottom/right. Closes gh-793.
Diffstat (limited to 'src/css.js')
-rw-r--r-- | src/css.js | 5 |
1 files changed, 4 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; |