mirror of https://github.com/twbs/bootstrap.git
				
				
				
			fixes #9111
This commit is contained in:
		
							parent
							
								
									dbed9da774
								
							
						
					
					
						commit
						a4f0e8d37a
					
				|  | @ -925,6 +925,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } | |||
|     this.$element | ||||
|       .removeClass('in') | ||||
|       .attr('aria-hidden', true) | ||||
|       .off('click.dismiss.modal') | ||||
| 
 | ||||
|     $.support.transition && this.$element.hasClass('fade') ? | ||||
|       this.$element | ||||
|  | @ -977,7 +978,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } | |||
|       this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') | ||||
|         .appendTo(document.body) | ||||
| 
 | ||||
|       this.$element.on('click', $.proxy(function (e) { | ||||
|       this.$element.on('click.dismiss.modal', $.proxy(function (e) { | ||||
|         if (e.target !== e.currentTarget) return | ||||
|         this.options.backdrop == 'static' | ||||
|           ? this.$element[0].focus.call(this.$element[0]) | ||||
|  |  | |||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -103,6 +103,7 @@ | |||
|     this.$element | ||||
|       .removeClass('in') | ||||
|       .attr('aria-hidden', true) | ||||
|       .off('click.dismiss.modal') | ||||
| 
 | ||||
|     $.support.transition && this.$element.hasClass('fade') ? | ||||
|       this.$element | ||||
|  | @ -155,7 +156,7 @@ | |||
|       this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') | ||||
|         .appendTo(document.body) | ||||
| 
 | ||||
|       this.$element.on('click', $.proxy(function (e) { | ||||
|       this.$element.on('click.dismiss.modal', $.proxy(function (e) { | ||||
|         if (e.target !== e.currentTarget) return | ||||
|         this.options.backdrop == 'static' | ||||
|           ? this.$element[0].focus.call(this.$element[0]) | ||||
|  |  | |||
|  | @ -153,4 +153,25 @@ $(function () { | |||
|         }) | ||||
|         .modal("show") | ||||
|     }) | ||||
| 
 | ||||
|     test("should trigger hide event once when clicking outside of modal-content", function () { | ||||
|       stop() | ||||
|       $.support.transition = false | ||||
|       var div = $("<div id='modal-test'><div class='contents'></div></div>") | ||||
|       var triggered | ||||
|       div | ||||
|         .bind("shown.bs.modal", function () { | ||||
|           triggered = 0 | ||||
|           $('#modal-test').click() | ||||
|         }) | ||||
|         .one("hidden.bs.modal", function() { | ||||
|           div.modal("show") | ||||
|         }) | ||||
|         .bind("hide.bs.modal", function () { | ||||
|           triggered += 1 | ||||
|           ok(triggered === 1, 'modal hide triggered once') | ||||
|           start() | ||||
|         }) | ||||
|         .modal("show") | ||||
|     }) | ||||
| }) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue