File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -483,8 +483,9 @@ jQuery.event = {
483483
484484 for ( ; cur !== this ; cur = cur . parentNode || this ) {
485485
486+ // Don't check non-elements (#13208)
486487 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
487- if ( cur . disabled !== true || event . type !== "click" ) {
488+ if ( cur . nodeType === 1 && ( cur . disabled !== true || event . type !== "click" ) ) {
488489 matches = [ ] ;
489490 for ( i = 0 ; i < delegateCount ; i ++ ) {
490491 handleObj = handlers [ i ] ;
Original file line number Diff line number Diff line change @@ -1834,6 +1834,17 @@ test( "delegated event with selector matching Object.prototype property (#13203)
18341834 equal ( matched , 0 , "Nothing matched 'toString'" ) ;
18351835} ) ;
18361836
1837+ test ( "delegated event with intermediate DOM manipulation (#13208)" , function ( ) {
1838+ expect ( 1 ) ;
1839+
1840+ jQuery ( "#foo" ) . on ( "click" , "[id=sap]" , function ( ) { } ) ;
1841+ jQuery ( "#sap" ) . on ( "click" , "[id=anchor2]" , function ( ) {
1842+ document . createDocumentFragment ( ) . appendChild ( this . parentNode ) ;
1843+ ok ( true , "Element removed" ) ;
1844+ } ) ;
1845+ jQuery ( "#anchor2" ) . trigger ( "click" ) ;
1846+ } ) ;
1847+
18371848test ( "stopPropagation() stops directly-bound events on delegated target" , function ( ) {
18381849 expect ( 1 ) ;
18391850
You can’t perform that action at this time.
0 commit comments