Download & Extend

Recall other modules javascript behaviors after ajax comment load

Project:More Comments
Version:7.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hi,
I kindly ask you if it would be possible to add a Drupal.attachBehaviors(data) after the ajax load is completed.
That would let other modules' javascripts to attach their behaviors to the new loaded comments.
I attach a patch below.
Thank you

Comments

#1

Here is the patch

AttachmentSize
morecomments_attachbehaviours-1810740-1.patch 440 bytes

#2

Status:active» needs work

+++ b/morecomments.js
@@ -14,6 +14,7 @@
+   Drupal.attachBehaviors(data);

Bad indentation. Use spaces instead of tabs please.

#3

Status:needs work» needs review

rerolling

AttachmentSize
morecomments.patch 457 bytes

#4

Fixed line format, reroll

AttachmentSize
morecomments.patch 446 bytes

#5

I tested a little bit more the patch and there was still a case where it wouldn't work.
To make behaviors always work we have to attach them on the morecomments-button's parent.
This is the new patch, it works in every case I tested.

AttachmentSize
morecomments_attachbehaviors-1810740-5.patch 574 bytes

#6

Status:needs review» fixed

Thanks! This also fix #1872792: Problem with ajax_comments.

Committed & Pushed to 7.x-1.x.

#7

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here