Quick question. Regarding no-jquery/no-global-selector, how are we are supposed to find elements if we can't use $( '#elementIWantToFind' )
? Aren't we at least going to need one of these somewhere so that we can find the correct skin element to before/after/append/prepend newly created elements to?
Topic on Manual talk:Coding conventions/JavaScript
Appearance
@Novem Linguae: I think the idea is to use hooks that pass in a jQuery object that's of narrower scope. For example, wikipage.content hook handlers get a $content object. That way, there's more control over the extensibility of the front end, rather than basically treating the whole output HTML as the API for gadgets to use (and then breaking things because it's not obvious where people are extending what).
The reason we have rules like this is not that it would be forbidden to have such code. You can mark exceptions as such, if needed. We just want people to think about it and consider alternatives, as Sam explained above.
The same applies to some of the "forbidden" functions in PHP, for example. Exceptions are allowed.