Skip to content

Commit

Permalink
Core: trigger events for elements outside their form
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonHeimberg committed Oct 30, 2018
1 parent 4a14d51 commit e7a4a9c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core.js
Expand Up @@ -424,6 +424,15 @@ $.extend( $.validator, {
// Support: Chrome, oldIE
// "select" is provided as event.target when clicking a option
.on( "click.validate", "select, option, [type='radio'], [type='checkbox']", delegate );
$( this.currentForm.elements ).filter( function( i, el ) {
return $( el ).closest( el.form ).length === 0;
} )
.filter( ":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " +
"[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " +
"[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " +
"[type='radio'], [type='checkbox'], [type='button']" )
.on( "focusin.validate focusout.validate keyup.validate", delegate ).end()
.filter( "select, option, [type='radio'], [type='checkbox']" ).on( "click.validate", delegate );

if ( this.settings.invalidHandler ) {
$( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler );
Expand Down

0 comments on commit e7a4a9c

Please sign in to comment.