@@ -19,6 +19,28 @@ var PROP_NAME = "datepicker",
19
19
dpuuid = new Date ( ) . getTime ( ) ,
20
20
instActive ;
21
21
22
+ function getZindex ( elem ) {
23
+ var position , value ;
24
+ while ( elem . length && elem [ 0 ] !== document ) {
25
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
26
+ // This makes behavior of this function consistent across browsers
27
+ // WebKit always returns auto if the element is positioned
28
+ position = elem . css ( "position" ) ;
29
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
30
+ // IE returns 0 when zIndex is not specified
31
+ // other browsers return a string
32
+ // we ignore the case of nested elements with an explicit value of 0
33
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
34
+ value = parseInt ( elem . css ( "zIndex" ) , 10 ) ;
35
+ if ( ! isNaN ( value ) && value !== 0 ) {
36
+ return value ;
37
+ }
38
+ }
39
+ elem = elem . parent ( ) ;
40
+ }
41
+
42
+ return 0 ;
43
+ }
22
44
/* Date picker manager.
23
45
Use the singleton instance of this class, $.datepicker, to interact with the date picker.
24
46
Settings for (groups of) date pickers are maintained in an instance object,
@@ -744,7 +766,7 @@ $.extend(Datepicker.prototype, {
744
766
if ( ! inst . inline ) {
745
767
showAnim = $ . datepicker . _get ( inst , "showAnim" ) ;
746
768
duration = $ . datepicker . _get ( inst , "duration" ) ;
747
- inst . dpDiv . zIndex ( $ ( input ) . zIndex ( ) + 1 ) ;
769
+ inst . dpDiv . css ( "z-index" , getZindex ( $ ( input ) ) + 1 ) ;
748
770
$ . datepicker . _datepickerShowing = true ;
749
771
750
772
if ( $ . effects && $ . effects . effect [ showAnim ] ) {
0 commit comments