Skip to content

Commit 9ced027

Browse files
mikesherovdmethvin
authored andcommitted
Fix #12537, element.css('filter') returns undefined in IE9. Close jquerygh-942.
1 parent 22fac5c commit 9ced027

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/css.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ if ( window.getComputedStyle ) {
290290

291291
if ( computed ) {
292292

293-
ret = computed[ name ];
293+
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
294+
ret = computed.getPropertyValue( name ) || computed[ name ];
295+
294296
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
295297
ret = jQuery.style( elem, name );
296298
}

test/unit/css.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,13 @@ test("certain css values of 'normal' should be convertable to a number, see #862
782782
ok( jQuery.isNumeric( parseFloat( el.css("fontWeight") ) ), "css('fontWeight') not convertable to number, see #8627" );
783783
});
784784

785+
// only run this test in IE9
786+
if ( document.documentMode === 9 ) {
787+
test( ".css('filter') returns a string in IE9, see #12537", 1, function() {
788+
equal( jQuery("<div style='-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFFFFF, endColorstr=#ECECEC)\";'></div>").css("filter"), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFFFFF, endColorstr=#ECECEC)", "IE9 returns the correct value from css('filter')." );
789+
});
790+
}
791+
785792
test( "cssHooks - expand", function() {
786793
expect( 15 );
787794
var result,

test/unit/effects.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,7 @@ asyncTest( "non-px animation handles non-numeric start (#11971)", 2, function()
16891689
var foo = jQuery("#foo"),
16901690
initial = foo.css("backgroundPositionX");
16911691

1692-
if ( initial == null ) {
1692+
if ( !initial ) {
16931693
expect(1);
16941694
ok( true, "Style property not understood" );
16951695
start();

0 commit comments

Comments
 (0)