Opened 10 years ago
Closed 10 years ago
#14770 closed bug (notabug)
Conflict with Prototype.js when triggering a custom event called `update`
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.11.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Triggering a custom event called update
inside a keyup
/keydown
event handler prevents default behaviour when Prototype.js is included. No exceptions are thrown, but keystrokes in a textarea (which trigger update
) have no effect.
keyup
test case: http://jsbin.com/finix/14/edit
This bug has been reproduced with jQuery versions:
- 1.8.3
- 1.9.1
- 1.10.2
- 1.11.0
with Prototype.js versions:
- 1.6.1.0
- 1.7.1
using the following Browsers:
- IE8 Win XP
- IE8 Win 7
- IE9 Win 7
- IE10 Win 7
- IE11 Win 7
Works as expected on recent versions of Chrome OS X (32.0.1700.102), Firefox OS X (27), and on IE6 and IE7 on Windows XP.
Note: See
TracTickets for help on using
tickets.
This is because Prototype adds an
.update()
method to the element.http://prototypejs.org/doc/latest/dom/Element/update/
Augmenting an object you don't own with non-standard methods is bad practice and the source of several problems with Prototype.
As jQuery documents, when an event is fired on an element jQuery calls the corresponding DOM method if found. If you don't want that to happen, use
.triggerHandler()
rather than.trigger()
.