Download & Extend

Adding / remove html from page should attach behaviors

Project:Active Tags
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

Whenever any html is added or removed from the page Drupal.attachBehaviors should be run on the new html that way other behaviors can attach to it.

Here is a patch for that.

AttachmentSize
active_tags_attach.patch1.8 KB

Comments

#1

I release that clicking the x to remove a tag no longer worked :-D here is a fix for that.

AttachmentSize
active_tags_attach-1.patch 2.65 KB

#2

Version:6.x-1.x-dev» 6.x-2.x-dev
Status:needs review» needs work

This is good work but I see several issues.

  1. We can not use .parent() for .prev() because it will cause all taxonomy fields to change when you have more than 1 taxonomy field enabled.
  2. There is no need for an attachBehaviors call in activeTagsUpdate because no html is being removed or added there. Only the value of a textfield is being changed.
  3. I am really lost in why all the changes to the remove functionality were needed. What purpose does it serve?
  4. The patch needs to be rerolled against the latest 2.x branch.

Thanks.

#3

We can not use .parent() for .prev() because it will cause all taxonomy fields to change when you have more than 1 taxonomy field enabled.

Doh! could call

There is no need for an attachBehaviors call in activeTagsUpdate because no html is being removed or added there. Only the value of a textfield is being changed.

So then in the remove click function then, it should attachBehaviors.

I am really lost in why all the changes to the remove functionality were needed. What purpose does it serve?

It created an infinite loop as it called activeTagsUpdate() which then calls attachBehaviors.