jQuery custom “remove” event with Chrome 24
On January 10th 2013, Google released version 24 of Chrome, which included an unexpected feature: the native
remove() method of an HTML element:
It’s essentially a shortcut for this:
While this seems like a welcome addition to the DOM API, it ended up causing all kinds of problems in our app, because we happen to use a custom event named remove. As soon as the “remove” custom event was triggered, the element would disappear! This happens because jQuery tries to call the native method on the element with the same name as the event. The most common example of this behavior would be:
$(element).trigger('click'); // the element will actually be "clicked"
Even though I now know that a new
remove() method exists, I wasn’t able to find any information about it in the Chrome release notes. If anyone has more information on this particular change, please let me know!