Skip to main content

Bug Tracker

Side navigation

#8033 closed bug (fixed)

Opened January 21, 2011 09:01PM UTC

Closed February 14, 2011 05:36PM UTC

jQuery 1.4.4+ fails to load on pages with old Prototype (<= 1.5) or Current Prototype + Scriptaculous in IE

Reported by: SlexAxton Owned by: SlexAxton
Priority: blocker Milestone: 1.5.1
Component: core Version: 1.4.4
Keywords: prototype, noconflict Cc:
Blocked by: Blocking:
Description

This seems to be because old Prototypes would override the getelementsbyclassname native function, and inside of it, they'd use the $ sign.

In old versions of jQuery (1.4.2) our sizzle came before we set our global variables, now it comes after. That seems to break.

Examples

http://jsfiddle.net/Bd7HU/7/ - jquery 1.4.4 and prototyp 1.5 fails

http:jsfiddle.net/wMx9E/1/ - jquery 1.4.2 and prototype 1.5 ok

http:jsfiddle.net/2zEj5/1/ - jquery 1.4.4 and prototype 1.6 // ok

I'd say not to worry about this, but it's a really easy fix. Just move

  window.jQuery = window.$ = jQuery;

to the end of the file... I'll submit a patch.

Attachments (0)
Change History (7)

Changed January 21, 2011 09:02PM UTC by SlexAxton comment:1

component: unfiledcore
keywords: → prototype, noconflict
milestone: 1.next1.5
owner: → SlexAxton
priority: undecidedlow
status: newassigned

Changed January 21, 2011 10:42PM UTC by SlexAxton comment:2

_comment0: Hmmm, looks like the issue _does_ happen in recent versions of Prototype as well. \ \ http://jsfiddle.net/dU7FB/2/ \ \ The same fix of moving the jQuery window leak to the bottom works. The build process is the only thing that makes this nontrivial.1295649746612475
_comment1: Hmmm, looks like the issue _does_ happen in recent versions of Prototype as well. \ \ http://jsfiddle.net/dU7FB/3/ \ \ The same fix of moving the jQuery window leak to the bottom works. The build process is the only thing that makes this nontrivial.1295649929884153

Hmmm, looks like the issue _does_ happen in recent versions of Prototype as well (in IEs only) if Scriptaclous is also on the page. (pretty common) (when prototype and scriptaculous come first).

http://jsfiddle.net/dU7FB/3/

The same fix of moving the jQuery window leak to the bottom works. The build process is the only thing that makes this nontrivial.

We created $.noConflict to allow people to work with these other libraries, and since the fix here is just switching where code is executed, it seems like a good faith effort to make things easy for everyone.

Changed January 24, 2011 03:30AM UTC by SlexAxton comment:3

I submitted a patch that passes all tests for this here:

https://github.com/jquery/jquery/pull/204

Changed January 24, 2011 11:13PM UTC by SlexAxton comment:4

summary: jQuery 1.4.4+ fails to load on pages with old Prototype (<= 1.5)jQuery 1.4.4+ fails to load on pages with old Prototype (<= 1.5) or Current Prototype + Scriptaculous in IE

Changed February 02, 2011 12:08PM UTC by jitter comment:5

milestone: → 1.5.1

Changed February 07, 2011 05:37PM UTC by john comment:6

priority: lowblocker

Changed February 14, 2011 05:36PM UTC by john comment:7

resolution: → fixed
status: assignedclosed

Landed.