Skip to main content

Bug Tracker

Side navigation

#14600 closed bug (notabug)

Opened December 03, 2013 09:12PM UTC

Closed December 03, 2013 09:16PM UTC

Last modified December 04, 2013 07:12PM UTC

trigger('remove') calls remove() method on DOM element

Reported by: Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

calling trigger with an event "remove" or any name spaced, will remove that DOM element.

This occurs:


Attachments (0)
Change History (4)

Changed December 03, 2013 09:16PM UTC by scottgonzalez comment:1

resolution: → notabug
status: newclosed

As documented on

Note: For both plain objects and DOM objects other than window, if a triggered event name matches the name of a property on the object, jQuery will attempt to invoke the property as a method if no event handler calls event.preventDefault(). If this behavior is not desired, use .triggerHandler() instead.

Changed December 03, 2013 10:44PM UTC by comment:2


Would you recommend always using event.preventDefault() when triggering custom events(NOT 'blur', 'change', 'click', 'focus' and so on) then?

Even though this has been labeled 'notabug', I doubt the original intent was to fire non-event related functions. I'd think that its use was to call 'blur', 'change', 'click', 'focus' and so on. 'remove' was not a function that a DOM element had available at the time this functionality was created. I could name an event type, 'insertBefore' and then I'd get an error in the console because I tried to call the DOM method with an incorrect number of parameters. While this may not technically be a bug, I'd say it's not following the intent of the event model.


Changed December 03, 2013 11:20PM UTC by scottgonzalez comment:3

Would you recommend always using event.preventDefault() when triggering custom events

No. I would recommend not using names that have easy collisions. Put a colon in your custom event name.

Changed December 04, 2013 07:12PM UTC by comment:4

Replying to [comment:3 scott.gonzalez]:

Thanks Scott. This is what I was looking for; using a colon for custom events makes sense. It prevents me or anyone else on our team from needing to know the future of DOM functionality. 'remove' was once a fine name to use but is no longer.