Skip to:
Content

BuddyPress.org

Opened 13 years ago

Closed 13 years ago

Last modified 10 years ago

#4782 closed defect (bug) (fixed)

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

Reported by: Lwangaman Owned by: boonebgorges
Priority: normal Milestone: 1.9
Component: Templates Version: 1.7
Severity: normal 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
13 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
13 years ago

  • Milestone Awaiting Review
  • Resolutionduplicate
  • Status newclosed

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

#3 @burakali
13 years ago

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

Version 0, edited 13 years ago by burakali (next)

#4 @burakali
13 years ago

  • Cc burakali added

#5 @burakali
13 years ago

  • Resolution duplicate
  • Status closedreopened
  • Version 1.71.8.1

#6 @r-a-y
13 years ago

  • Component CoreTheme
  • Keywords reporter-feedback added
  • MilestoneAwaiting Review
  • Severity blockernormal
  • Type taskdefect (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
13 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
13 years ago

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

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

#9 @boonebgorges
13 years ago

  • Owner set to boonebgorges
  • Resolutionfixed
  • Status reopenedclosed

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
10 years ago

  • Component Appearance - Template PartsTemplates
Note: See TracTickets for help on using tickets.