Bug Tracker

Opened 10 years ago

Closed 9 years ago

#4994 closed feature (worksforme)

new ajax 'target' option upon which ajaxEvents are triggered, when specified

Reported by: nbubna Owned by: flesler
Priority: major Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: ajax events load trigger Cc: nbubna
Blocked by: Blocking:

Description

Supports a new 'target' option for $.ajax. When specified, all ajax events (ajaxStart and such) are triggered on that, instead of being globally triggered. For $.fn.load calls (and plugins that do similar things), this provides a means to identify the element upon which the ajax action is being done.

See: http://groups.google.com/group/jquery-dev/browse_thread/thread/caf31f67a3ac159c

Attachments (2)

jquery4994.patch (2.2 KB) - added by nbubna 10 years ago.
Suggested implementation
ajax.patch (5.0 KB) - added by flesler 10 years ago.

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by nbubna

Attachment: jquery4994.patch added

Suggested implementation

comment:1 Changed 10 years ago by flesler

Cc: nbubna added
need: ReviewPatch
Owner: set to flesler
Status: newassigned
Type: enhancementfeature

Changed 10 years ago by flesler

Attachment: ajax.patch added

comment:2 Changed 10 years ago by flesler

Resolution: fixed
Status: assignedclosed

Applied at [6563]

comment:3 Changed 9 years ago by ngrilly

Resolution: fixed
Status: closedreopened

Function $(selector).load() was modified in changeset [6563] in order to use the DOM element as the context of the call to $.ajax.

Looking at jQuery most recent source code, it looks like this change was reverted:

http://github.com/jquery/jquery/blob/master/src/ajax.js#L56

Is there a reason for that?

comment:4 Changed 9 years ago by snover

Resolution: worksforme
Status: reopenedclosed

If you need a context for an operation, you have to do it manually through $.ajax. Automatic context change for the global events is never provided, consistently.

Note: See TracTickets for help on using tickets.