matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
- sel = handleObj.selector;
+
+ // Don't conflict with Object.prototype properties (#13203)
+ sel = handleObj.selector + " ";
if ( matches[ sel ] === undefined ) {
matches[ sel ] = handleObj.needsContext ?
markup.remove();
});
+test( "delegated event with selector matching Object.prototype property (#13203)", function() {
+ expect(1);
+
+ var matched = 0;
+
+ jQuery("#foo").on( "click", "toString", function( e ) {
+ matched++;
+ });
+
+ jQuery("#anchor2").trigger("click");
+
+ equal( matched, 0, "Nothing matched 'toString'" );
+});
+
test("stopPropagation() stops directly-bound events on delegated target", function() {
expect(1);