mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fix #10798. Don't re-bubble trigger()ed events in IE.
Since .trigger() already bubbles the event, we don't have to work around the non-bubbling IE events for that case.
This commit is contained in:
parent
ca8fc725ac
commit
80797f5805
@ -752,8 +752,8 @@ if ( !jQuery.support.submitBubbles ) {
|
|||||||
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
|
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
|
||||||
if ( form && !form._submit_attached ) {
|
if ( form && !form._submit_attached ) {
|
||||||
jQuery.event.add( form, "submit._submit", function( event ) {
|
jQuery.event.add( form, "submit._submit", function( event ) {
|
||||||
// Form was submitted, bubble the event up the tree
|
// If form was submitted by the user, bubble the event up the tree
|
||||||
if ( this.parentNode ) {
|
if ( this.parentNode && !event.isTrigger ) {
|
||||||
jQuery.event.simulate( "submit", this.parentNode, event, true );
|
jQuery.event.simulate( "submit", this.parentNode, event, true );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -793,7 +793,7 @@ if ( !jQuery.support.changeBubbles ) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
jQuery.event.add( this, "click._change", function( event ) {
|
jQuery.event.add( this, "click._change", function( event ) {
|
||||||
if ( this._just_changed ) {
|
if ( this._just_changed && !event.isTrigger ) {
|
||||||
this._just_changed = false;
|
this._just_changed = false;
|
||||||
jQuery.event.simulate( "change", this, event, true );
|
jQuery.event.simulate( "change", this, event, true );
|
||||||
}
|
}
|
||||||
@ -807,7 +807,7 @@ if ( !jQuery.support.changeBubbles ) {
|
|||||||
|
|
||||||
if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
|
if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
|
||||||
jQuery.event.add( elem, "change._change", function( event ) {
|
jQuery.event.add( elem, "change._change", function( event ) {
|
||||||
if ( this.parentNode && !event.isSimulated ) {
|
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
|
||||||
jQuery.event.simulate( "change", this.parentNode, event, true );
|
jQuery.event.simulate( "change", this.parentNode, event, true );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -129,11 +129,28 @@ th, td {
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<form id="autosub"><input type=submit name=subme /></form>
|
||||||
|
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
|
|
||||||
$("#version").text(version);
|
$("#version").text(version);
|
||||||
$("#fileversion").text($.fn.jquery);
|
$("#fileversion").text($.fn.jquery);
|
||||||
|
|
||||||
|
// Try an auto-submit, it should only fire once
|
||||||
|
$(function(){
|
||||||
|
var triggered = false;
|
||||||
|
$("#autosub input").trigger("keypress");
|
||||||
|
$("body").on("submit", "#autosub", function( e ){
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
if ( triggered ) {
|
||||||
|
alert("autosubmit FAIL");
|
||||||
|
}
|
||||||
|
triggered = true;
|
||||||
|
});
|
||||||
|
$("#autosub").submit().remove();
|
||||||
|
});
|
||||||
|
|
||||||
// Events we want to track in row-order
|
// Events we want to track in row-order
|
||||||
var events = "bind-change live-change on-change bind-propertychange live-beforeactivate live-focusin bind-focus live-beforedeactivate live-focusout bind-blur live-click live-keydown".split(" "),
|
var events = "bind-change live-change on-change bind-propertychange live-beforeactivate live-focusin bind-focus live-beforedeactivate live-focusout bind-blur live-click live-keydown".split(" "),
|
||||||
counter = 0;
|
counter = 0;
|
||||||
@ -179,10 +196,13 @@ for ( var i=0; i < events.length; i++ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jQuery.fn.blink = function(){
|
jQuery.fn.blink = function(){
|
||||||
return this.css("backgroundColor","green").css("border","solid 3px green").delay(700).queue(function(next){
|
return this
|
||||||
jQuery(this).css("backgroundColor","");
|
.css("backgroundColor","green")
|
||||||
next();
|
.text( (parseInt(this.text(), 10) || 0) + 1 )
|
||||||
});
|
.delay(700).queue(function(next){
|
||||||
|
jQuery(this).css("backgroundColor","#afa");
|
||||||
|
next();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
jQuery.fn.addSubmitTest = function( id, prevent ) {
|
jQuery.fn.addSubmitTest = function( id, prevent ) {
|
||||||
@ -197,6 +217,7 @@ jQuery.fn.addSubmitTest = function( id, prevent ) {
|
|||||||
$("#text_submit").addSubmitTest("#textSubmit", true);
|
$("#text_submit").addSubmitTest("#textSubmit", true);
|
||||||
$("#password_submit").addSubmitTest("#passwordSubmit", true);
|
$("#password_submit").addSubmitTest("#passwordSubmit", true);
|
||||||
$("#submit_submit").addSubmitTest("#submitSubmit", true);
|
$("#submit_submit").addSubmitTest("#submitSubmit", true);
|
||||||
|
$("#prog_submit").addSubmitTest("#submitSubmit", true);
|
||||||
$(document).bind("submit", function(){
|
$(document).bind("submit", function(){
|
||||||
jQuery("#boundSubmit").blink();
|
jQuery("#boundSubmit").blink();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user