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 = {
483
483
484
484
for ( ; cur !== this ; cur = cur . parentNode || this ) {
485
485
486
+ // Don't check non-elements (#13208)
486
487
// 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" ) ) {
488
489
matches = [ ] ;
489
490
for ( i = 0 ; i < delegateCount ; i ++ ) {
490
491
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)
1834
1834
equal ( matched , 0 , "Nothing matched 'toString'" ) ;
1835
1835
} ) ;
1836
1836
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
+
1837
1848
test ( "stopPropagation() stops directly-bound events on delegated target" , function ( ) {
1838
1849
expect ( 1 ) ;
1839
1850
You can’t perform that action at this time.
0 commit comments