Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 11 years ago

Last modified 8 years ago

#4782 closed defect (bug) (fixed)

"Read More" link doesn't fire when another AJAX action is fired first

Reported by: lwangaman's profile Lwangaman Owned by: boonebgorges's profile boonebgorges
Milestone: 1.9 Priority: normal
Severity: normal Version: 1.7
Component: Templates Keywords: has-patch
Cc: don, burakali

Description

buddypress's "global.js" script makes use of jquery's deprecated $.live() method. The $.live() method is no longer valid as of jQuery 1.9, it has now been substituted by the $.on() method, which can be attached to the "document" element itself thus having the same effect as the $.live()" method.
Therefore must substitute for example:

$('.activity-read-more a').live('click',function(event){...});

with:

$(document).on('click','.activity-read-more a',function(event){...});

Idem for all similar instances of $.live().

Change History (10)

#1 @sbrajesh
12 years ago

this has been addressed in a previous ticket for BuddyPress 1.7 branch.
Please have a look at this #4714

Though, there may exist a bug for activity-read-more in the current code, as activity items are dynamically loaded for pagination and read more link will not work(the on should not be bound on dynamically inserted element).

A better idea will be to bind it to activity div like

jq('div.activity').on('click','.activity-read-more a',function(event){...});

#2 @DJPaul
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Already fixed; but thank you very much for reporting the issue.

#3 @burakali
11 years ago

In Buddypress 1.8.1, this issue still continues. The necessary change proposed above is not implemented in the global.js or buddypress.js. Please check.

Last edited 11 years ago by burakali (previous) (diff)

#4 @burakali
11 years ago

  • Cc burakali added

#5 @burakali
11 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened
  • Version changed from 1.7 to 1.8.1

#6 @r-a-y
11 years ago

  • Component changed from Core to Theme
  • Keywords reporter-feedback added
  • Milestone set to Awaiting Review
  • Severity changed from blocker to normal
  • Type changed from task to defect (bug)

burakali - In BP 1.8.1, there isn't any reference to .live() or .browser() in buddypress.js / global.js:

Can you provide any further details?

#7 @burakali
11 years ago

As stated in the description of this ticket, when the 'activity-read-more' live('click;) call was corrected with on('click)... the targeted class stayed ".activity-read-more a" which is inside the dynamic area. It should be something like 'div.activity' or 'document'. See below:

jq('div.activity').on('click','.activity-read-more a',function(event){...}); --as sbrajesh stated above or
jq('document').on('click','.activity-read-more a',function(event){...});

The problem at the moment is when you change a tab or load more activity(which loads new content through ajaxcall), read-more link which is part of activity that is loaded dynamically doesnt fire the ajax call anymore and doesnt slide open. It redirects to the single activity page instead...

#8 @r-a-y
11 years ago

  • Keywords has-patch added; reporter-feedback removed
  • Milestone changed from Awaiting Review to 1.9
  • Summary changed from jQuery 1.9 has deprecated the methods "$.live()" and "$.browser()" to "Read More" link doesn't fire when another AJAX action is fired first
  • Version changed from 1.8.1 to 1.7

Thanks for the additional steps to duplicate, burakali. Bug reproduced.

#9 @boonebgorges
11 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from reopened to closed

In 7610:

Use delegation for activity stream Read More links

This ensures that dynamically added items (as when loading more items on a
page via AJAX) will register click events.

Fixes #4782

Props sbrajesh, burakali

#10 @DJPaul
8 years ago

  • Component changed from Appearance - Template Parts to Templates
Note: See TracTickets for help on using tickets.