Skip to main content

Bug Tracker

Side navigation

#844 closed bug (wontfix)

Opened January 17, 2007 09:54PM UTC

Closed May 16, 2008 06:07PM UTC

Last modified March 14, 2012 08:00PM UTC

Loading jQuery 1.1 with Prototype throws error

Reported by: dossy@panoptic.com Owned by:
Priority: major Milestone: 1.2.4
Component: event Version: 1.1.3
Keywords: prototype Cc:
Blocked by: Blocking:
Description

Loading jQuery 1.1 with Prototype on Firefox 1.5.0.9 results in this error:

this.bind is not a function
  return f ? this.bind(o, f) : this.trigger(o);
jquery.js (line 1418)
Attachments (0)
Change History (10)

Changed January 31, 2007 05:00PM UTC by brandon comment:1

resolution: → worksforme
status: newclosed

This works for me. Please feel free to reopen the ticket with a more detailed test case.

Changed May 27, 2007 10:53AM UTC by aercolino comment:2

resolution: worksforme
status: closedreopened

Changed July 15, 2007 02:16PM UTC by john comment:3

description: Loading jQuery 1.1 with Prototype on Firefox 1.5.0.9 results in this error:\ \ {{{\ this.bind is not a function\ return f ? this.bind(o, f) : this.trigger(o);\ jquery.js (line 1418)\ }}}Loading jQuery 1.1 with Prototype on Firefox 1.5.0.9 results in this error: \ \ {{{ \ this.bind is not a function \ return f ? this.bind(o, f) : this.trigger(o); \ jquery.js (line 1418) \ }}}
milestone: → 1.1.4
need: → Review
resolution: → worksforme
status: reopenedclosed
version: 1.11.1.3

This works fine. Please don't re-open the bug unless you have something to back up the claim.

Changed September 29, 2007 06:46PM UTC by aercolino comment:4

resolution: worksforme
status: closedreopened

This problem is still unresolved (jQuery 1.2.1).

Here is how you can reproduce the error.

1- install the bookmarklet jQuerify into your FireFox browser

2- go to http://www.google.com, jQuerify it, and at the FireBug console run the following command

jQuery( 'body' ).bind( 'click', function() { alert( 'Hi' ) } )

3- click on the page and you'll see the alert

4- go to http://developer.mozilla.org/, jQuerify it, and at the FireBug console run the previous command

Changed November 17, 2007 10:34PM UTC by davidserduke comment:5

resolution: → worksforme
status: reopenedclosed

jQuerify isn't exactly the best way to load jQuery. Plus to get jQuery to work with Prototype you must use .noConflict() after jQuery is loaded (which jQuerify does not do). When I tried jQuerify with the Mozilla site I started getting lots of Prototype errors.

Next time you open the bug please do so with your own single html page which shows the conflict and please read the documentation on what is necessary for it to work.

http://docs.jquery.com/Core/jQuery.noConflict

Changed November 24, 2007 11:38PM UTC by aercolino comment:6

I started getting lots of Prototype errors

That's very strange, because I cannot see any error at all...

I'm using last version of FF2, with Firebug, and my jQueryfy bookmarklet is

javascript:var%20s=document.createElement('script');s.setAttribute('src',%20'http://jquery.com/src/jquery-latest.js');document.body.appendChild(s);s.onload=function(){jQuery.noConflict()};void(s);

As you see jQuery.noConflict() is in place :-), and $ and jQuery are different things on the Mozilla site, after jQueryfying it. Anyway, this is a different issue, I think.

This bug is annoying because it makes my HotChili plugin useless for the Mozilla site!

And there is a lot of code there that I'd like to see highlighted.

Changed February 07, 2008 09:50PM UTC by fernborba comment:7

resolution: worksforme
status: closedreopened

Hello,

The same error is happening with me.

Above you can see the HEAD of the page:

<script type="text/javascript" src="/Data/AJAX/Rico/Prototype.js"></script>
<script type="text/javascript" src="/Data/AJAX/Rico/AJAX.js"></script>
<script type="text/javascript" src="/Data/AJAX/Ara.js"></script>

<script src="lib/jquery-1.2.1.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/jquery.dimensions.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/jquery.accordion.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
    <!--
	var $j = jQuery.noConflict();
    $j(function () {
        $j('ul.drawers').accordion({
            header: 'div.drawer-handle',
            selectedClass: 'open',
            event: 'mouseover'
        });
    });
    //-->    
</script>

And the firefox 2.0.0.11 gives me this error:

Error: this.bind is not a function
Source File: http://localhost/NewPage/lib/jquery-1.2.1.js
Line: 1984

If there's a answer for that I'm sorry but I'vent saw it yet...

Changed February 17, 2008 06:42PM UTC by brandon comment:8

This seems to be caused by Prototype extending the Function.prototype to include a bind method.

Changed April 15, 2008 04:32PM UTC by mtrimpe comment:9

We also just ran into the problem and it's caused by namespace clashes on Object.extend and Function.bind.

Because we're on a deadline here; we implemented a slightly less than elegant workaround.

The solution was to rename both the Function's bind method and the Object's extend method in PrototypeJS to something else (e.g. prototypeBind and prototypeExtend). When you do this throughout the Prototype library and for any references in your local code jQuery once again works like a charm.

Changed May 16, 2008 06:07PM UTC by flesler comment:10

component: coreevent
milestone: 1.1.41.2.4
resolution: → wontfix
status: reopenedclosed

This doesn't seem like something that can (has to be) fixed by jQuery.

Once Prototype avoids clashing the global namespace, this will cease (maybe they did already).

I'll close this for now.