Generally speaking, I don't shy from having additional selectors for attaching click behaviors (or mouseover or whatever) for Behaviors. That is to say, here I think I would just have additional options for the behavior to find the elements that should pause the slideshow. Then your behavior filter would run that selector (element.getElements(api.get('pauseOnClickSelector')) or whatever). As a rule of thumb all my filters use element.getElement (or getElements) and rely on the selector to be from the behavior enhanced element. This often requires you to do something like `!body div#foo` to go up from the element to some parent and then down again to the target. I digress.
You CAN create delegator as controls though. The trick is that the element that is the delegate has a selector to the elements that are enhanced by behavior (i.e. your form input has a delegator for focus or whatever and one of its arguments is a selector that points to the slideshow container that has the behavior=Slideshow or what-have-you). It then uses Element.getBehaviorResult(filtername) to get the instance of the slideshow and calls a method on it. Something like:
Delegator.register(['click', 'focus'], 'PauseSlideshow', {
require: ['slideShowContainer']
handler: function(event, element, api){
event.preventDefault();
var target = element.getElement(api.get('slideShowContainer'));
if (!target) return; //only continue if the slideshow is available. Fail quietly.
var slideshow = element.getBehaviorResult('Slideshow');
if (!slideshow) return; //ditto
slideshow.pause();
}
});
The key with using delegators this way is to fail quietly, I think. This allows your DOM to change and not break. Up to you though; you could use api.fail or api.warn if you want to note these in the console. One of the cardinal rules of behaviors is that they don't depend on each other (behavior plugins do though) and they aren't order dependent. When using Delegator to control instances created by Behavior, I try to follow the same rule. It's glue code though, so sometimes you need to be smart about how you handle that failure; it depends on how critical the glue is...
-a