Commit Graph

123 Commits

Author SHA1 Message Date
jeresig
31432e048f Add .delegate() and .undelegate(). An alternative to using .live() which goes from a single root and filters by the specified selectors. Should be used like do: .delegate(td, hover, someFn);. Fixes #6005. 2010-02-01 18:06:03 -05:00
jeresig
0252b78201 Provide a way to simulate default browser actions. Fixes #5973. 2010-01-28 14:34:09 -05:00
jeresig
390186b902 Make sure that special.add actually copies over event namespaces and data. Fixes #5779 and #5834. 2010-01-25 17:01:07 -05:00
jeresig
0474917c9d Make sure multiple bound events have their namespaces and data maintained. Fixes #3549. 2010-01-25 16:45:39 -05:00
jeresig
d24443fb55 Make sure that it's possible to preventDefault natively-triggered (submit, focus, blur, click) events. Fixes #5695. 2010-01-25 13:45:07 -05:00
jeresig
3e286440d5 Make sure that .die() with no args works. Fixes #5789. 2010-01-23 16:37:12 -05:00
Irae Brasil
01f72026ec Added support for multiple live event handlers, live hover, and live focus/blur (mapped to focusin/focusout). Fixes #5804, #5801, #5852. 2010-01-23 11:56:24 -05:00
Irae Brasil
150e44cdda Make sure non-left-click events don't bubble. Fixes #3861. 2010-01-23 11:12:26 -05:00
jeresig
366039a6f0 Revert "Adding in backwards-compatiblity support for jQuery().bind/unbind/trigger - and immediately deprecating it. Please explicitly use jQuery(document) in your code."
This reverts commit e9d5947b4a.
2010-01-11 13:48:40 -05:00
jeresig
e9d5947b4a Adding in backwards-compatiblity support for jQuery().bind/unbind/trigger - and immediately deprecating it. Please explicitly use jQuery(document) in your code. 2010-01-06 11:32:29 -05:00
jeresig
66975de2d2 Remove the .bind(name, fn, thisObject) and promote jQuery.event.proxy() to jQuery.proxy() as alternative to handling scoping on callbacks. Fixes #5736. 2009-12-31 00:37:23 -05:00
Alexander Farkas
5dc6b7ce34 Used the patch from Alexander as the basis for a rewrite of the IE change event logic. Now has full parity with the regular change event in other browsers: Works with regular bind, works better with multiple selects, works as a regular change event (note test suite changes), works with readonly/disabled inputs, and much more. The original patch had a number of problems, including firing the change event too many times, not bubblinb properly, and not handling clicks on multi-selects properly - that should all be fixed now. Thanks Alexander for the patch pushing in the right direction. 2009-12-21 15:32:32 -05:00
John Resig
1052792bb2 Fixed problems with removing live events. Fixes #4894. 2009-12-09 14:43:53 -08:00
Justin Meyer
d42afd0f65 Adding in support for bubbling submit and change events, thanks to the patch by Justin Meyer. Includes a delegation test suite for manually testing to see if the events work as intended. 2009-12-04 11:28:50 -05:00
jeresig
21dead4691 Simplified a selector in the .live() tests. 2009-11-30 14:02:03 -05:00
jeresig
6e5a6a26a7 Tweaked the live test to be a bit simpler. 2009-11-30 13:50:25 -05:00
Robert Katic
04dbdb7525 Corrected RegExp to match event namespaces. Fixes #5303. 2009-11-26 00:58:39 +08:00
Mr Speaker
5cb1163469 Making sure that you can bind multiple toggles to a single element without problems. Thanks to 'Mr Speaker' for the original patch. Fixes #5274. 2009-11-11 09:46:24 -05:00
Yehuda Katz
45dfa3b0fc Probably not the optimal solution, but tests pass. 2009-09-16 08:33:00 +00:00
Ariel Flesler
9ebb2fc654 jquery event: closes #5250. bind(), unbind() and one() support Object Literals (needs some refactor though) 2009-09-16 02:19:18 +00:00
Ariel Flesler
8356871a55 testrunner: focus & blur events could fail if the window isn't focused 2009-09-15 17:11:15 +00:00
Ariel Flesler
5e0da8c036 testrunner: resetting the scroll position after focusing a field 2009-09-14 23:28:21 +00:00
Ariel Flesler
bca8225413 jquery event: fixes #4989. blur and focus events now bubble and can be handled using live(). 2009-09-14 22:04:22 +00:00
Brandon Aaron
ee34b6982a fix for #3533, triggering an event with a colon in the name on a table no longer throws an error in IE 2009-06-17 02:31:45 +00:00
Brandon Aaron
811891785f .bind() now accepts an optional thisObject as the last argument which is used to change the value of this in event callbacks. fixes #3699 2009-05-07 00:50:28 +00:00
Brandon Aaron
8f042d8be3 fix for #4234. hover can take one function to use for both enter and leave. 2009-05-06 02:17:24 +00:00
Brandon Aaron
4460d5ad59 unit tests for using jQuery events on non-dom elements. fixes #3439. thanks morgan 2009-05-04 04:54:09 +00:00
Brandon Aaron
aef1989ba7 live event handlers now receive data from trigger, fixes #4532, thanks nbubna 2009-04-30 21:50:15 +00:00
Brandon Aaron
71efbdd3b2 refactor specialAll into add and remove hooks for existing special events, live now accepts optional data param like bind, fixes #4612 and #4613, thanks to Mike Helgeson 2009-04-30 21:44:25 +00:00
Brandon Aaron
45b8d2531e enable test for binding events cross-frame that was fixed in r6316 2009-04-29 22:04:41 +00:00
Brandon Aaron
851846aabe .unbind() without any arguments now also unbinds namespaced events. fixes #4609 and #4241 2009-04-29 21:45:58 +00:00
Brandon Aaron
30e760b63f fix for #4189, live/die now work with contexts other than just document 2009-03-20 03:10:07 +00:00
Ariel Flesler
48164ee603 jquery event: Fixing event.currentTarget for live(). 2009-02-23 13:27:48 +00:00
John Resig
8d9aa015c1 Changed the currentTarget test - no need to test the native event triggering for this test. 2009-02-17 17:22:59 +00:00
Ariel Flesler
63f8bb7027 testrunner: Misc 2009-02-17 12:42:46 +00:00
Ariel Flesler
0a1b0db347 jquery event: closes #4033. e.currentTarget wasn't being enforced for native events (IE doesn't have it) 2009-02-17 12:38:16 +00:00
John Resig
9aa0c69c43 Fixed bubbling of live events (if an inner element handles an event first - and stops progatation - then the parent event doesn't encounter the event). Thanks to Irae for the patch. Fixes bug #3980. 2009-02-09 23:29:57 +00:00
John Resig
a78557472c Focused support of .live(). stopPropagation and stopImmediatePropagation are not supported - and do not do what the use would expect. 2009-01-20 17:25:37 +00:00
John Resig
b1018cad12 Landed a fix for when a DOM element gets accidentally removed by another live event handler. Thanks to Irae for the patches. Fixed #3820. 2009-01-10 19:57:07 +00:00
John Resig
ec7baf230d Didn't get specific enough with the proxy guid, fixes #3787. 2009-01-09 22:14:48 +00:00
John Resig
d12e8a34e6 Made it so that you can bind a single function to multiple .live() selectors. Additionally, simplified the proxy code to provide a default proxy function.
Fixes #3787.
2009-01-09 22:10:42 +00:00
Ariel Flesler
eced38a30d testrunner: refactored unbind's tests. Including one for #3538, passing since last commit. 2009-01-08 22:22:33 +00:00
John Resig
b1e161466c Disabled an extra event binding. 2009-01-05 23:06:57 +00:00
Ariel Flesler
989e3f61f7 jquery event: closes #3772. The extra function on $.event.trigger isn't supported anymore. 2009-01-02 22:23:52 +00:00
Ariel Flesler
c0446c70d5 jquery event:
* event objects have isDefaultPrevented, isPropagationStopped and isImmediatePropagationStopped methods.
* Removed donative and dohandlers from $.trigger
* event.result carries the last returned data from a handler(not undefined).
* $.trigger doesn't keep bubbling if stopPropagation() is called.
* Same event object is used all along for global trigger
* Fixed the bug where target doesn't change when triggering on many elements.
* The data array on $.trigger was accumulating objects as it bubbles.
testrunner: adding more tests
2008-12-31 02:58:13 +00:00
John Resig
4f7441910f Made sure that return false works in .live() along with the event object being passed in as the first argument. 2008-12-30 20:45:33 +00:00
Ariel Flesler
4f99e793fa jquery event: jQuery.Event can be instantiated without the 'new' keyword. 2008-12-29 21:57:29 +00:00
Ariel Flesler
4ca4ce52f7 jquery event: Closes #3662. Adds a jQuery.Event class. Makes trigger and fix simpler. Adds currentTarget attribute to event objects. Event object isn't passed as part of data. 2008-12-25 21:44:54 +00:00
John Resig
c03a280155 Added a new liveQuery/event delegation hybrid method: .live and .die. Easily adapts event delegation to the jQuery style. $("div").live("click", fn); $("div > #foo").live("submit", fn); $("div").die("click"); 2008-12-22 04:59:34 +00:00
John Resig
67ded9a36a Made sure that the correct event.taget is being used in event bubbling. 2008-12-22 02:02:05 +00:00
John Resig
25885e07b2 Added support for bubbling triggered events. 2008-12-22 01:57:06 +00:00
John Resig
77344f4c50 Added support for multiple-namespaced events (in bind, trigger, and unbind). 2008-12-19 04:34:12 +00:00
Jörn Zaefferer
12bb969411 core: tests cleanup for compability with qunit updates: stop() now actually accepts an argument (ajax.js); selectors should be confined to fixture(event.js) 2008-10-24 14:40:58 +00:00
Ariel Flesler
b860c30b82 test runner: Commented 2 tests that jam the suite. 2008-10-21 01:48:23 +00:00
Ariel Flesler
9e48649729 test runner: the changes are:
- Replaced all the $ for jQuery in the tests and suite.
- Added a noConflict to testrunner.js.
- Modified the test for noConflict() so that it still work.
- Added jQuery 1.2.1 and 1.2.3 to otherlibs.
2008-05-28 23:18:25 +00:00
Ariel Flesler
407c5eb430 test runner: extra test case, [5501] 2008-05-08 16:25:12 +00:00
Ariel Flesler
ba48be3ada test runner: translated all the ok() with '==' to equals(), as it gives more information on failures. 2008-05-06 18:56:02 +00:00
Ariel Flesler
d822c0c214 test runner: adding a test case for $.fn._toggle with more than 2 functions. 2008-04-29 22:20:02 +00:00
Jörn Zaefferer
32b1cb3a5c jquery.event: Patch for #2708 2008-04-22 21:59:40 +00:00
Brandon Aaron
5d033dba02 Trigger onclick handlers of links 2008-04-21 20:39:17 +00:00
John Resig
703e89ba30 Added support for .unbind(".test") to unbind all namespaced events on an element. 2008-02-03 04:33:11 +00:00
Jörn Zaefferer
2fa855601e fix for #2114; refactored tests for bind() to highlight failing select-change-test 2008-01-14 09:33:08 +00:00
John Resig
3261544c38 Fixed #2027 - make sure that cloned elements (within appendTo, etc.) have their events cloned by default. 2007-12-20 13:36:56 +00:00
David Serduke
b740fe5632 Fixed a problem in the unit tests for IE where an optimization made the test case not work. The optimization was fine. It was the unit test that was taking a short cut which caused it to fail after the optimization went in. 2007-12-20 07:39:35 +00:00
Jörn Zaefferer
70ae356e4e Test for #2069 2007-12-17 17:39:50 +00:00
Brandon Aaron
b264f789b9 new special events api, ready is now a first class event that you can use bind, unbind or the ready helper, two new events: mouseenter and mouseleave, the hover helper method now uses mouseenter and mouseleave, bind and unbind can now take a space sperated list of event types 2007-12-15 05:55:33 +00:00
Brandon Aaron
91f1299f68 Fix for #1486. Prevent IE from throwing an error when triggering focus on hidden input. 2007-12-08 02:54:09 +00:00
David Serduke
ffbedf0262 Fixed #1039 and #1733 by going through the core API and making them text node and comment node safe. 2007-12-07 01:52:21 +00:00
David Serduke
66fbbec3bb Fixed [1993] although it actually wasn't a bug in the core but rather a misunderstanding of how the extra function was supposed to work in jQuery.event.trigger(). That said, it seems more useful and robust for the code to work the way the ticket author thought it should work so this change was made.
Now, if anything is returned from the extra function it will overwrite the return value of the event handlers.  This should only effect custom events unless someone had an extra function that returned a value other than false which would have been ignored before.
2007-12-03 21:41:10 +00:00
David Serduke
3ae5fbc16a Fixed #1701 by passing through the arguments as suggested. 2007-11-28 22:23:40 +00:00
John Resig
d5f2129ac4 Fixed an issue with the suite expecting a different result for the changed triggerHandler behavior. 2007-09-15 02:23:08 +00:00
John Resig
3a4e1233aa Landing the new expando management code. Completely overhauls how data is associated with elements.
Plugins will be most interested in:
- jQuery.data(elem) -> Unique ID for the element
- jQuery.data(elem, name) -> Named data store for the element
- jQuery.data(elem, name, value) -> Saves a value to the named data store
- jQuery.removeData(elem) -> Remove the expando and the complete data store
- jQuery.removeData(elem, name) -> Removes just this one named data store

jQuery's .remove() and .empty() automatically clean up after themselves. Once an element leaves a DOM document their events are no longer intact. Thus, statements like so:
{{{
  $("#foo").remove().appendTo("#bar");
}}}
should be written like so:
{{{
  $("#foo").appendTo("#bar");
}}}
in order to avoid losing the bound events.
2007-09-08 23:31:23 +00:00
John Resig
6728e3cf74 Finished up some of the reorganization. 2007-09-08 12:46:01 +00:00