diff options
author | Scott González <scott.gonzalez@gmail.com> | 2013-03-15 07:01:24 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2013-03-15 07:01:24 -0400 |
commit | 932caaf2ddf70c889003d5b42eee4f069d2dd296 (patch) | |
tree | f6c8ad8102d49dd51392ea58b5105297ccd50cf1 /ui | |
parent | ae9651931f3d0704b33322a7d6f4750c1d83ccf7 (diff) | |
download | jquery-ui-932caaf2ddf70c889003d5b42eee4f069d2dd296.tar.gz jquery-ui-932caaf2ddf70c889003d5b42eee4f069d2dd296.zip |
Core: Deprecated .zIndex(). Fixes #9061 - Core: Deprecate .zIndex().
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.core.js | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index 1a13da251..0d263fa5f 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -78,35 +78,6 @@ $.fn.extend({ return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent; }, - zIndex: function( zIndex ) { - if ( zIndex !== undefined ) { - return this.css( "zIndex", zIndex ); - } - - if ( this.length ) { - var elem = $( this[ 0 ] ), position, value; - while ( elem.length && elem[ 0 ] !== document ) { - // Ignore z-index if position is set to a value where z-index is ignored by the browser - // This makes behavior of this function consistent across browsers - // WebKit always returns auto if the element is positioned - position = elem.css( "position" ); - if ( position === "absolute" || position === "relative" || position === "fixed" ) { - // IE returns 0 when zIndex is not specified - // other browsers return a string - // we ignore the case of nested elements with an explicit value of 0 - // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> - value = parseInt( elem.css( "zIndex" ), 10 ); - if ( !isNaN( value ) && value !== 0 ) { - return value; - } - } - elem = elem.parent(); - } - } - - return 0; - }, - uniqueId: function() { return this.each(function() { if ( !this.id ) { @@ -263,6 +234,35 @@ $.fn.extend({ enableSelection: function() { return this.unbind( ".ui-disableSelection" ); + }, + + zIndex: function( zIndex ) { + if ( zIndex !== undefined ) { + return this.css( "zIndex", zIndex ); + } + + if ( this.length ) { + var elem = $( this[ 0 ] ), position, value; + while ( elem.length && elem[ 0 ] !== document ) { + // Ignore z-index if position is set to a value where z-index is ignored by the browser + // This makes behavior of this function consistent across browsers + // WebKit always returns auto if the element is positioned + position = elem.css( "position" ); + if ( position === "absolute" || position === "relative" || position === "fixed" ) { + // IE returns 0 when zIndex is not specified + // other browsers return a string + // we ignore the case of nested elements with an explicit value of 0 + // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> + value = parseInt( elem.css( "zIndex" ), 10 ); + if ( !isNaN( value ) && value !== 0 ) { + return value; + } + } + elem = elem.parent(); + } + } + + return 0; } }); |