Bug Tracker

Opened 11 years ago

Closed 11 years ago

#3515 closed bug (invalid)

ajaxStop not being bubbled to 'body' element

Reported by: tamlyn Owned by:
Priority: minor Milestone: 1.3
Component: ajax Version: 1.2.6
Keywords: Cc: tamlyn, flesler
Blocked by: Blocking:

Description

This code works fine

$('#content').ajaxStart(function(){
	$(this).addClass('loading');
}).ajaxStop(function(){
	$(this).removeClass('loading');
});

but this doesn't:

$('body').ajaxStart(function(){
	$(this).addClass('loading');
}).ajaxStop(function(){
	$(this).removeClass('loading');
});

When attaching the event listeners to the body element it seems ajaxStop is not being triggered because the 'loading' class is not removed.

This, on the other hand, works fine:

$('#content').ajaxStart(function(){
	$('body').addClass('loading');
}).ajaxStop(function(){
	$('body').removeClass('loading');
});

Change History (5)

comment:1 Changed 11 years ago by flesler

Cc: tamlyn flesler added

It works for me. Are you doing this inside a document.ready ?

comment:2 Changed 11 years ago by flesler

need: ReviewTest Case

Can you make a test case to reproduce the problem ?

comment:3 Changed 11 years ago by flesler

By the way... bubbling is not related to this at all.

comment:4 Changed 11 years ago by tamlyn

Hmmm, made a test case and it worked - tested the original and that now works too! Sorry about that. Please close as invalid.

comment:5 Changed 11 years ago by flesler

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.