My favorites | Sign in
Project Home Wiki
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 159: Unnecessary dependency on Plone's 'jq' jQuery object in
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Apr 2011

Sign in to add a comment
Reported by, Mar 5, 2011
A minor issue, but worth fixing.

JavaScript code in includes the line:


It should be:


jq is Plone's name for jQuery's usual $ variable. But since uses a local $ bound to the jQuery object, using jq isn't necessary.

Issue applies to the current trunk, i.e.
Line 41.
Mar 6, 2011
Project Member #1
Actually, the best way to do this is to do:

(function($) {



And then use the $ variable only in that function body.
Mar 6, 2011
Project Member #2

I think when the initialization is done that way, the code is executed directly when the JS-file is parsed, but the DOM may not be ready at this point.
I had some troubles doing it that way, so I usually do it this way:

jQuery(function($) {

in this case the function is executed as soon as the DOM is ready (but maybe the DOM-event will get deprecated in some point?).

See also:

Mar 6, 2011
Project Member #3
No, I mean, inside that function(), you do:

$(document).ready(function() { ... });

See the jquery docs for details.
Mar 6, 2011
The way the jQuery is being invoked is fine. It's the standard construct.

$(document).ready(function() {



The only issue is that removeClass call, which references a global jq object when it should reference the local $ object.
Apr 9, 2011
Project Member #5
Fixed in
Status: Fixed
Sign in to add a comment

Powered by Google Project Hosting