Side navigation
#6371 closed bug (wontfix)
Opened March 29, 2010 05:26AM UTC
Closed April 17, 2011 05:11PM UTC
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 (4)
Changed March 29, 2010 05:28AM UTC by comment:1
Changed November 12, 2010 02:40AM UTC by comment:2
milestone: | 1.4.3 |
---|
Resetting milestone to future.
Changed November 19, 2010 10:26AM UTC by comment:3
keywords: | noConflict → noConflict needsreview |
---|---|
priority: | → undecided |
Bikeshed/feature creep.
Changed April 17, 2011 05:11PM UTC by comment:4
keywords: | noConflict needsreview → noConflict |
---|---|
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.
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>