Opened 13 years ago
Closed 12 years ago
#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: | |
Blocked by: | Blocking: |
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 (2)
Change History (6)
Changed 13 years ago by
Attachment: | jquery.noconflict.patch added |
---|
comment:1 Changed 13 years ago by
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 12 years ago by
Keywords: | needsreview added |
---|---|
Priority: | → undecided |
Bikeshed/feature creep.
comment:4 Changed 12 years ago by
Keywords: | needsreview removed |
---|---|
Milestone: | → 1.next |
Priority: | undecided → low |
Resolution: | → wontfix |
Status: | new → closed |
Version: | 1.4.2 → 1.5.2 |
Agree with snover. noConflict should be called before loading mootools. Setting the $ to undefined might actually be preferable in other use cases.
Patch to prevent jQuery.noConflict() from reverting $ if $ is not jQuery