Delegator removeTrigger's purpose when you have options?

3 views
Skip to first unread message

Rolf-nl

unread,
Jan 14, 2012, 10:06:39 AM1/14/12
to Clientcide
When I needed a simple list-item-clone mechanism for a concept I
thought it was a good idea to use Delegator to add some click actions.

Simply put: when you click a list item a clone is made and injected
into some target list element.
The clone has all attributes copied, including the trigger. So to
remove it I would call: clone.removeTrigger('DelegatorName');
I wondered about the default options attribute, should it be be
deleted as well if there are any? If not, why not, should options be
deleted by hand if you want to clean up the dom? If you are going to
delete options should there be the ability to add options to when you
call addTrigger?

These thoughts just came up after using removeTrigger.. and I wonder
how you used it in practice.

Cheers

Aaron Newton

unread,
Jan 14, 2012, 5:42:18 PM1/14/12
to clien...@googlegroups.com
I've never had a use for doing this so I hadn't considered it. The BehaviorAPI is a read-only interface; assuming that you're going to set options in the HTML itself or if you must, with Element.setData. I could see the utility of having the ability to add a trigger or behavior and pass in the options for it (and for the obverse, where removeBehavior and removeTrigger can take a second argument, a Boolean, that, if true, would remove the options specified for that behavior/trigger). If this is something you'd like to see, send me a pull request with docs, specs, and code. Generally, my inclination would be to leave the options as they are and just remove the behavior/trigger, but I could see the value in being able to reset them.


--
You received this message because you are subscribed to the Google Groups "Clientcide" group.
To post to this group, send email to clien...@googlegroups.com.
To unsubscribe from this group, send email to clientside+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/clientside?hl=en.


Rolf-nl

unread,
Jan 16, 2012, 3:35:31 PM1/16/12
to Clientcide
I only thought about it when I was cloning an element and seeing that
behaviors where "active" - my first thought was "hey, cloning doesn't
clone events, what's happening" quickly realizing I was using
behavior ;)
I'm inclined to leave it as is at the moment and keep this mention
here as a reference about it.
Reply all
Reply to author
Forward
0 new messages