Fix #12537, element.css('filter') returns undefined in IE9. Close gh-942.

This commit is contained in:
Mike Sherov 2012-09-30 17:41:42 -04:00 committed by Dave Methvin
parent 22fac5c2e4
commit 9ced027465
3 changed files with 11 additions and 2 deletions

View File

@ -290,7 +290,9 @@ if ( window.getComputedStyle ) {
if ( computed ) {
ret = computed[ name ];
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
ret = computed.getPropertyValue( name ) || computed[ name ];
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}

View File

@ -782,6 +782,13 @@ test("certain css values of 'normal' should be convertable to a number, see #862
ok( jQuery.isNumeric( parseFloat( el.css("fontWeight") ) ), "css('fontWeight') not convertable to number, see #8627" );
});
// only run this test in IE9
if ( document.documentMode === 9 ) {
test( ".css('filter') returns a string in IE9, see #12537", 1, function() {
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')." );
});
}
test( "cssHooks - expand", function() {
expect( 15 );
var result,

View File

@ -1689,7 +1689,7 @@ asyncTest( "non-px animation handles non-numeric start (#11971)", 2, function()
var foo = jQuery("#foo"),
initial = foo.css("backgroundPositionX");
if ( initial == null ) {
if ( !initial ) {
expect(1);
ok( true, "Style property not understood" );
start();