//Use href (if anchor) to get url to external content.
//Append response to global this.tooltip and call show();
return false; //in case target is an anchor, we don't want window to load href location.
This seems like an easy way to implement a tooltip that can work anywhere on the site, for any anchor tag with "show-tooltip" class. Easy doesn't necessarily mean best. I'd like to know what's wrong with doing something like this.
Plus ... there is no need to use ready here. Use init. And, I would suggest appending the tooltip to the element the controller is on. This will scroll 'with' the user (if that is something that might be needed).
I don't think I understand how this is different than letting the controller bind itself to the document with onDocument:true.
I'm assuming that Org.Tooltip would look similar to my example, but instead of letting it bind itself, I'd manually initialize it and attach it to the body instead. I don't mind doing that; I just felt like the auto-initializing was convenient and not necessarily 'wrong'.
If DocumentControllers are to be deprecated in future versions, I'll refrain from using them.
[EDIT: Take the example lightly. It's not a real implementation, just an example I slapped together while writing the post; Trying to get the use-case across.]
I read some very valid points you brought up about publish/subscribing to global channels in other posts, and I see how those points can be applied to global controllers. I'll see if I can find the other post you're referring to.
I don't quite see the problem with this Controller though. It's not extensible, or easily changed for different implementations of a tooltip, but if the implementation is consistent for all tooltips, it still seems to be a solution. I refrain from calling it a "good" solution because I'm still learning the appropriate way to use events w/ JSMVC (Please, pardon my ignorance :)).
I may be interpreting your response incorrectly, so these responses may not apply:
With this controller I can add any number of anchor tags with "show-tooltip" class that, when clicked, bubble, are caught by the controller, and show the tooltip with content loaded using the target elements href attribute.
For localized tooltips, would it be wrong to use data attributes on the target element that get read by the controller? <a href="/" data-localized="true" />.
Would it be possible for you to provide a small outline of a Controller that would be more appropriate to use in a case like this?