#2166 closed bug (invalid)
Bind error injecting jQuery
Reported by: | sullof | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.2.4 |
Component: | event | Version: | 1.2.2 |
Keywords: | bind | Cc: | |
Blocked by: | Blocking: |
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 (6)
comment:1 Changed 15 years ago by
Priority: | major → minor |
---|
comment:2 Changed 15 years ago by
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 15 years ago by
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 15 years ago by
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 15 years ago by
This seems to be caused by Prototypes addition of a bind method to the native Function prototype.
comment:6 Changed 15 years ago by
Milestone: | 1.2.3 → 1.2.4 |
---|---|
Resolution: | → invalid |
Status: | new → closed |
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.
This appears to be related to #844. I expect a much simpler test case will be necessary to debug it.