Side navigation
#2166 closed bug (invalid)
Opened January 15, 2008 01:14PM UTC
Closed May 16, 2008 07:26PM UTC
Last modified March 15, 2012 09:37AM UTC
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.
Attachments (0)
Change History (6)
Changed January 18, 2008 04:13AM UTC by comment:1
priority: | major → minor |
---|
Changed January 18, 2008 04:16AM UTC by comment:2
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 January 19, 2008 11:32PM UTC by comment:3
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 January 20, 2008 04:17PM UTC by comment:4
I think that the problem is not related to Prototype itself. In fact, Twitter uses Prototype but in this case all works perfectly.
Changed February 17, 2008 07:21AM UTC by comment:5
This seems to be caused by Prototypes addition of a bind method to the native Function prototype.
Changed May 16, 2008 07:26PM UTC by comment:6
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.