Commit 32d61d75 authored by George Kats's avatar George Kats Committed by Richard Gibson

Fix #14432: Always return string from .css("z-index"). Close gh-1395.

(cherry picked from commit 5ce4b06c)

Conflicts:

	src/css/curCSS.js
parent 62900a9e
...@@ -51,7 +51,9 @@ if ( window.getComputedStyle ) { ...@@ -51,7 +51,9 @@ if ( window.getComputedStyle ) {
} }
} }
return ret; // Support: IE
// IE returns zIndex value as an integer.
return ret === undefined ? ret : ret + "";
}; };
} else if ( document.documentElement.currentStyle ) { } else if ( document.documentElement.currentStyle ) {
getStyles = function( elem ) { getStyles = function( elem ) {
...@@ -99,7 +101,11 @@ if ( window.getComputedStyle ) { ...@@ -99,7 +101,11 @@ if ( window.getComputedStyle ) {
} }
} }
return ret === "" ? "auto" : ret; return ret === "" ? "auto" :
// Support: IE
// IE returns zIndex value as an integer.
ret === undefined ? ret :
ret + "";
}; };
} }
......
...@@ -200,6 +200,16 @@ test( "css() explicit and relative values", 29, function() { ...@@ -200,6 +200,16 @@ test( "css() explicit and relative values", 29, function() {
equal( $elem.css("opacity"), "1", "'+=0.5' on opacity (params)" ); equal( $elem.css("opacity"), "1", "'+=0.5' on opacity (params)" );
}); });
test("css(String) where values are z-index", function() {
expect(1);
var $elem = jQuery( "<div>" ).appendTo( "#qunit-fixture" );
$elem.css({ "position": "absolute", "z-index": "1000" });
strictEqual( $elem.css( "z-index" ), "1000" );
});
test("css(String, Object)", function() { test("css(String, Object)", function() {
expect( 19 ); expect( 19 );
var j, div, display, ret, success; var j, div, display, ret, success;
...@@ -393,6 +403,14 @@ test("css(Object) where values are Functions", function() { ...@@ -393,6 +403,14 @@ test("css(Object) where values are Functions", function() {
jQuery("#cssFunctionTest").remove(); jQuery("#cssFunctionTest").remove();
}); });
test("css(String) where values are undefined", function() {
expect(1);
var $elem = jQuery( "#nothiddendiv" );
strictEqual( $elem.css( "test" ), undefined );
});
test("css(Object) where values are Functions with incoming values", function() { test("css(Object) where values are Functions with incoming values", function() {
expect(3); expect(3);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment