Bug Tracker

Ticket #2166 (closed bug: invalid)

Opened 7 years ago

Last modified 3 years ago

Bind error injecting jQuery

Reported by: sullof Owned by:
Priority: minor Milestone: 1.2.4
Component: event Version: 1.2.2
Keywords: bind Cc:
Blocking: Blocked by:

Description

PassPack autologin button doesn't work with some websites because jQuery fails to manage events.

Consider, for example,  http://www.digg.com. If you run the following code with Firebug to inject jQuery into a page:

var s1=document.createElement('script');
s1.src='http://www.passpack.com/beta/js/jquery-1.2.2.js';
document.getElementsByTagName('head')[0].appendChild(s1);

and after the following:

jQuery(document).click(function(e) {
    alert(1);
});

you can view that clicking on body of Digg.com, it alerts 1. But, if you try it, for example, on  http://www.reddit.com, the bind fails. It produces an error connected to the following jQuery code:

// Handle event binding
jQuery.fn[name] = function(fn){
return fn ? this.bind(name, fn) : this.trigger(name);
};

Note that with versions of jQuery < 1.2 it worked well.

Change History

comment:1 Changed 7 years ago by davidserduke

  • Priority changed from major to minor

This appears to be related to #844. I expect a much simpler test case will be necessary to debug it.

comment:2 Changed 7 years ago by davidserduke

Is bind a reserved word in Prototype? It looks like their bind is overwriting ours or something. Every function appears to have bind(), extend(), and toJSONString() attached to it.

comment:3 Changed 7 years ago by sullof

If you take a free  PassPack account, you can try to autologin on Reddit.com using the "PassPack It!" button. In this case, you can see that Firebug shows exactly the error of ticket #844. I remember that in september autologin worked well on reddit.com, so I suppose that the problem is related to recent version of Prototype.

comment:4 Changed 7 years ago by sullof

I think that the problem is not related to Prototype itself. In fact, Twitter uses Prototype but in this case all works perfectly.

comment:5 Changed 7 years ago by brandon

This seems to be caused by Prototypes addition of a bind method to the native Function prototype.

comment:6 Changed 6 years ago by flesler

  • Status changed from new to closed
  • Resolution set to invalid
  • Milestone changed from 1.2.3 to 1.2.4

Based on the ticket david linked (#844), this really is a prototype issue. Renaming the methods of Prototype seems to fix the issue (as someone said in the other ticket).

I think this doesn't need to be handled on our side, please try renaming Prototype's methods on your test case, and if the issue still arises.. reopen.

Note: See TracTickets for help on using tickets.