File tree 2 files changed +26
-2
lines changed
2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,11 @@ var rformElems = /^(?:textarea|input|select)$/i,
18
18
return quick ;
19
19
} ,
20
20
quickIs = function ( elem , m ) {
21
+ var attrs = elem . attributes || { } ;
21
22
return (
22
23
( ! m [ 1 ] || elem . nodeName . toLowerCase ( ) === m [ 1 ] ) &&
23
- ( ! m [ 2 ] || elem . id === m [ 2 ] ) &&
24
- ( ! m [ 3 ] || m [ 3 ] . test ( ( ( elem . attributes || { } ) [ "class" ] || { } ) . value ) )
24
+ ( ! m [ 2 ] || ( attrs . id || { } ) . value === m [ 2 ] ) &&
25
+ ( ! m [ 3 ] || m [ 3 ] . test ( ( attrs [ "class" ] || { } ) . value ) )
25
26
) ;
26
27
} ,
27
28
hoverHack = function ( events ) {
Original file line number Diff line number Diff line change @@ -1209,6 +1209,29 @@ test("Delegated events in SVG (#10791)", function() {
1209
1209
svg . remove ( ) ;
1210
1210
} ) ;
1211
1211
1212
+ test ( "Delegated events in forms (#10844)" , function ( ) {
1213
+ expect ( 1 ) ;
1214
+
1215
+ // Aliases names like "id" cause havoc
1216
+ var form = jQuery (
1217
+ '<form id="myform">' +
1218
+ '<input type="text" name="id" value="secret agent man" />' +
1219
+ '</form>'
1220
+ ) . appendTo ( "body" ) ;
1221
+
1222
+ jQuery ( "body" )
1223
+ . on ( "submit" , "#myform" , function ( ) {
1224
+ ok ( true , "delegated id selector with aliased name" ) ;
1225
+ return false ;
1226
+ } )
1227
+ . find ( "#myform" )
1228
+ . trigger ( "submit" )
1229
+ . end ( )
1230
+ . off ( "submit" ) ;
1231
+
1232
+ form . remove ( ) ;
1233
+ } ) ;
1234
+
1212
1235
test ( "jQuery.Event( type, props )" , function ( ) {
1213
1236
1214
1237
expect ( 5 ) ;
You can’t perform that action at this time.
0 commit comments