| 312 | | $('a, :input').bind(this.events, function() { |
| 313 | | // allow use of the element if inside a dialog and |
| 314 | | // - there are no modal dialogs |
| 315 | | // - there are modal dialogs, but we are in front of the topmost modal |
| 316 | | var allow = false; |
| 317 | | var $dialog = $(this).parents('.ui-dialog'); |
| 318 | | if ($dialog.length) { |
| 319 | | var $overlays = $('.ui-dialog-overlay'); |
| 320 | | if ($overlays.length) { |
| 321 | | var maxZ = parseInt($overlays.css('z-index'), 10); |
| 322 | | $overlays.each(function() { |
| 323 | | maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10)); |
| 324 | | }); |
| 325 | | allow = parseInt($dialog.css('z-index'), 10) > maxZ; |
| 326 | | } else { |
| 327 | | allow = true; |
| | 312 | // we use a setTimeout in case the overlay is created from an |
| | 313 | // event that we're going to be cancelling (see #2804) |
| | 314 | setTimeout(function() { |
| | 315 | $('a, :input').bind($.ui.dialog.overlay.events, function() { |
| | 316 | // allow use of the element if inside a dialog and |
| | 317 | // - there are no modal dialogs |
| | 318 | // - there are modal dialogs, but we are in front of the topmost modal |
| | 319 | var allow = false; |
| | 320 | var $dialog = $(this).parents('.ui-dialog'); |
| | 321 | if ($dialog.length) { |
| | 322 | var $overlays = $('.ui-dialog-overlay'); |
| | 323 | if ($overlays.length) { |
| | 324 | var maxZ = parseInt($overlays.css('z-index'), 10); |
| | 325 | $overlays.each(function() { |
| | 326 | maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10)); |
| | 327 | }); |
| | 328 | allow = parseInt($dialog.css('z-index'), 10) > maxZ; |
| | 329 | } else { |
| | 330 | allow = true; |
| | 331 | } |