Skip to main content

Bug Tracker

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 elijahr comment:1

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>

Changed November 12, 2010 02:40AM UTC by snover comment:2

milestone: 1.4.3

Resetting milestone to future.

Changed November 19, 2010 10:26AM UTC by snover comment:3

keywords: noConflictnoConflict needsreview
priority: → undecided

Bikeshed/feature creep.

Changed April 17, 2011 05:11PM UTC by timmywil comment:4

keywords: noConflict needsreviewnoConflict
milestone: → 1.next
priority: undecidedlow
resolution: → wontfix
status: newclosed
version: 1.4.21.5.2

Agree with snover. noConflict should be called before loading mootools. Setting the $ to undefined might actually be preferable in other use cases.