Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'fix_8403' of https://github.com/lrbabe/jquery into lrba…

…be-fix_8403
  • Loading branch information...
commit 430d9e0b066512f00ceb7573249b45747d7792ff 2 parents 7bfb6a7 + 581fa82
John Resig jeresig authored
7 src/css.js
@@ -231,7 +231,8 @@ if ( !jQuery.support.opacity ) {
231 231 },
232 232
233 233 set: function( elem, value ) {
234   - var style = elem.style;
  234 + var style = elem.style,
  235 + currentStyle = elem.currentStyle;
235 236
236 237 // IE has trouble with opacity if it does not have layout
237 238 // Force it by setting the zoom level
@@ -241,11 +242,11 @@ if ( !jQuery.support.opacity ) {
241 242 var opacity = jQuery.isNaN(value) ?
242 243 "" :
243 244 "alpha(opacity=" + value * 100 + ")",
244   - filter = style.filter || "";
  245 + filter = currentStyle && currentStyle.filter || style.filter || "";
245 246
246 247 style.filter = ralpha.test(filter) ?
247 248 filter.replace(ralpha, opacity) :
248   - style.filter + ' ' + opacity;
  249 + filter + " " + opacity;
249 250 }
250 251 };
251 252 }
2  test/data/testsuite.css
... ... @@ -1,5 +1,5 @@
1 1 /* for testing opacity set in styles in IE */
2   -ol#empty { opacity: 0; filter:Alpha(opacity=0); }
  2 +ol#empty { opacity: 0; filter:Alpha(opacity=0) progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffff0000', EndColorStr='#ffffffff'); }
3 3
4 4 div#fx-tests h4 {
5 5 background: red;
5 test/unit/css.js
... ... @@ -1,7 +1,7 @@
1 1 module("css", { teardown: moduleTeardown });
2 2
3 3 test("css(String|Hash)", function() {
4   - expect(41);
  4 + expect( 42 );
5 5
6 6 equals( jQuery('#main').css("display"), 'block', 'Check for css property "display"');
7 7
@@ -58,6 +58,9 @@ test("css(String|Hash)", function() {
58 58 equals( jQuery('#empty').css('opacity'), '0', "Assert opacity is accessible via filter property set in stylesheet in IE" );
59 59 jQuery('#empty').css({ opacity: '1' });
60 60 equals( jQuery('#empty').css('opacity'), '1', "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" );
  61 + jQuery.support.opacity ?
  62 + ok(true, "Requires the same number of tests"):
  63 + ok( ~jQuery("#empty")[0].currentStyle.filter.indexOf("gradient"), "Assert setting opacity doesn't overwrite other filters of the stylesheet in IE" );
61 64
62 65 var div = jQuery('#nothiddendiv'), child = jQuery('#nothiddendivchild');
63 66

0 comments on commit 430d9e0

Please sign in to comment.
Something went wrong with that request. Please try again.