Ticket #6371 (closed bug: wontfix)
jQuery.noConflict() changes the value of $ even if $ !== jQuery
| Reported by: | elijahr | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | core | Version: | 1.5.2 |
| Keywords: | noConflict | Cc: | |
| Blocking: | Blocked by: |
Description
Suppose I have the following:
<script src="jquery.js"></script> <script src="mootools.js"></script> <script> alert($) alerts mootools' $ function jQuery.noConflict() alert($) alerts 'undefined' </script>
This seems like a bug; it in fact introduces a conflict and breaks mootools. If $!==jQuery, calling jQuery.noConflict() should return without changing the value of $.
I have attached a patch.
Attachments
Change History
Changed 3 years ago by elijahr
-
attachment
jquery.noconflict.patch
added
comment:1 Changed 3 years ago by elijahr
Since my line breaks were stripped, here goes again: <script src="jquery.js"></script> <script src="mootools.js"></script> <script> alert($); /* alerts mootools' $ function */ jQuery.noConflict(); alert($); /* alerts 'undefined' */</script>
comment:3 Changed 3 years ago by snover
- Keywords needsreview added
- Priority set to undecided
Bikeshed/feature creep.
comment:4 Changed 2 years ago by timmywil
- Status changed from new to closed
- Priority changed from undecided to low
- Version changed from 1.4.2 to 1.5.2
- Milestone set to 1.next
- Keywords needsreview removed
- Resolution set to wontfix
Agree with snover. noConflict should be called before loading mootools. Setting the $ to undefined might actually be preferable in other use cases.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Patch to prevent jQuery.noConflict() from reverting $ if $ is not jQuery