Bug Tracker

Ticket #2166 (closed bug: invalid)

Opened 10 months ago

Last modified 2 weeks ago

Bind error injecting jQuery

Reported by: sullof Assigned to: anonymous
Type: bug Priority: minor
Milestone: 1.2.4 Component: event
Version: 1.2.2 Keywords: bind
Cc: Needs: Review

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.

Attachments

Change History

Changed 10 months 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.

Changed 10 months 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.

Changed 10 months 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.

Changed 10 months 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.

Changed 9 months ago by brandon

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

Changed 6 months 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.