Skip to content

Use locally scoped jQuery alias instead of jQuery #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Use locally scoped jQuery alias instead of jQuery #9

wants to merge 1 commit into from

Conversation

acusti
Copy link
Contributor

@acusti acusti commented Dec 6, 2013

By using the local $ var instead of jQuery inside the module, this script can be included on a page and jQuery.noConflict(true) can be called after it without issue.

Makes for an easy solution for people who want to have a clean global namespace or who need to manage a situation with multiple jQuery libraries (or a similarly messy situation).

By using the local `$` var instead of `jQuery` inside the module, this script can be included on a page and `jQuery.noConflict(true)` can be called after it without issue
@gnarf
Copy link
Owner

gnarf commented Feb 6, 2014

Thanks for the submission!

I actually meant to have the internal closure variable named jQuery such that it used the locally scoped version and didn't use $ at all.

@acusti
Copy link
Contributor Author

acusti commented Feb 6, 2014

So you wanted line 10 to be:

(function( jQuery ) {

instead of

(function( $ ) {

?

@gnarf
Copy link
Owner

gnarf commented Feb 7, 2014

yup - that was the intention... uglify will reduce all jQuery to "a" basically, I don't like using the $ alias for jQuery after years of working on core where it is never allowed.

I'd rather make sure jshint complains about $ missing as well 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants