Plug-in passing the jQuery wrapper object as "this"
In response to
a recent thread , I created a quick plug-in. You can see it at
http://jsbin.com/ocodi/21/edit. It has a strange feature, and I wonder if others would find it wrong-headed.
This plug-in treats the jQuery wrapper object as a group, and passes the whole wrapper in as the context object (the "this") for the functions supplied. Generally, when functions are supplied as parameters, either the context is irrelevant, or each DOM element in the jQuery wrapper is passed. But I don't do that. My plug-in keeps a reference to the jQuery wrapper and calls the functions in that context.
This is necessary, because the whole idea is to act on a number of elements as a group -- in this case by fading in and out all members of the group when any individual one is hovered -- but I don't recall seeing this done elsewhere in the jQuery ecosphere. Are there other examples of this behavior? Does it seem reasonable? Or is it likely to trip up someone?
Cheers,
-- Scott