aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.datepicker.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2013-03-15 06:53:09 -0400
committerScott González <scott.gonzalez@gmail.com>2013-03-15 06:53:09 -0400
commitae9651931f3d0704b33322a7d6f4750c1d83ccf7 (patch)
treea0646025a6cc8758e7d5dcf0db78907b670b61d5 /ui/jquery.ui.datepicker.js
parent43442c319643ee9fb6f54737d921ba8b03f3ae6b (diff)
downloadjquery-ui-ae9651931f3d0704b33322a7d6f4750c1d83ccf7.tar.gz
jquery-ui-ae9651931f3d0704b33322a7d6f4750c1d83ccf7.zip
Datepicker: Don't use .zIndex(); implement the logic locally.
Diffstat (limited to 'ui/jquery.ui.datepicker.js')
-rw-r--r--ui/jquery.ui.datepicker.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index efee7a819..5892e2ddc 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -19,6 +19,28 @@ var PROP_NAME = "datepicker",
dpuuid = new Date().getTime(),
instActive;
+function getZindex( elem ) {
+ var 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;
+}
/* Date picker manager.
Use the singleton instance of this class, $.datepicker, to interact with the date picker.
Settings for (groups of) date pickers are maintained in an instance object,
@@ -744,7 +766,7 @@ $.extend(Datepicker.prototype, {
if (!inst.inline) {
showAnim = $.datepicker._get(inst, "showAnim");
duration = $.datepicker._get(inst, "duration");
- inst.dpDiv.zIndex($(input).zIndex()+1);
+ inst.dpDiv.css( "z-index", getZindex( $( input ) ) + 1 );
$.datepicker._datepickerShowing = true;
if ( $.effects && $.effects.effect[ showAnim ] ) {