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 @@ -410,8 +410,9 @@ jQuery.event = {
410410
411411 for ( ; cur != this ; cur = cur . parentNode || this ) {
412412
413+ // Don't check non-elements (#13208)
413414 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
414- if ( cur . disabled !== true || event . type !== "click" ) {
415+ if ( cur . nodeType === 1 && ( cur . disabled !== true || event . type !== "click" ) ) {
415416 matches = [ ] ;
416417 for ( i = 0 ; i < delegateCount ; i ++ ) {
417418 handleObj = handlers [ i ] ;
Original file line number Diff line number Diff line change @@ -1811,6 +1811,17 @@ test( "delegated event with selector matching Object.prototype property (#13203)
18111811 equal ( matched , 0 , "Nothing matched 'toString'" ) ;
18121812} ) ;
18131813
1814+ test ( "delegated event with intermediate DOM manipulation (#13208)" , function ( ) {
1815+ expect ( 1 ) ;
1816+
1817+ jQuery ( "#foo" ) . on ( "click" , "#sap" , function ( ) { } ) ;
1818+ jQuery ( "#sap" ) . on ( "click" , "#anchor2" , function ( ) {
1819+ jQuery ( this . parentNode ) . remove ( ) ;
1820+ ok ( true , "Element removed" ) ;
1821+ } ) ;
1822+ jQuery ( "#anchor2" ) . trigger ( "click" ) ;
1823+ } ) ;
1824+
18141825test ( "stopPropagation() stops directly-bound events on delegated target" , function ( ) {
18151826 expect ( 1 ) ;
18161827
You can’t perform that action at this time.
0 commit comments