Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #9421 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

[PATCH] Event.extend is not a function 1.6.0rc_0

Reported by: staaky Assigned to: sam, Tobie
Priority: high Milestone: 2.x
Component: Prototype Version: edge
Severity: major Keywords: event extend createwrapper
Cc: haraldmartin

Description

When binding events while the page is rendering an error is thrown by createWrapper. Event.extend is not a function.

Reproduce the error: http://nickstakenburg.com/tests/events/

I hope this can be fixed. Having to wait before attaching events kind of takes the fun out of it. I don't see why this is happening at the moment but I'll keep digging.

Attachments

event-extend-not-a-function.diff (1.5 kB) - added by staaky on 09/10/07 14:36:30.
event-extend-not-a-function.2.diff (1.6 kB) - added by staaky on 09/10/07 14:38:48.

Change History

08/30/07 18:53:55 changed by Maciek

I see this as well on a project I'm working on. It's quite hard to catch but it happens once in a while. In our project, it's more likely to happen if the mouse is moving around or over top of elements which are being observed or will be observed (the bug happens during the initial load of a page). I'm not sure which elements or element is triggering the error yet (we have quite a few on the screen).

Firebug output is:

Event.extend is not a function wrapper(mouseover clientX=0, clientY=0)prototype.js (line 3866) Event.extend(event);

09/08/07 13:02:24 changed by r0land

Same problem over here with my tooltip script :[

event.stop(); aint helping

09/10/07 10:56:41 changed by r0land

I changed Event.extend(event); into:

if(typeof Event.extend == 'function') Event.extend(event);

Now prototype suddenly breakes down at line 239; $A is not defined [Break on this error] return method.apply(null, [this].concat($A(arguments)));

09/10/07 12:55:46 changed by staaky

That works for me.

I've had the $A is not defined bug in some other cases and solved it by adding:

if(typeof $A === 'function')

in Prototype.function.bind and bindAsEventListener just above the return as described here http://www.skybyte.net/articles/prototype.js/.

In #5393 the '$A is not defined' bug seems to set to 'wontfix' :s

09/10/07 14:36:30 changed by staaky

  • attachment event-extend-not-a-function.diff added.

09/10/07 14:38:48 changed by staaky

  • attachment event-extend-not-a-function.2.diff added.

09/10/07 16:51:41 changed by staaky

  • summary changed from Event.extend is not a function 1.6.0rc_0 to [PATCH] Event.extend is not a function 1.6.0rc_0.

09/12/07 11:03:51 changed by haraldmartin

  • cc set to haraldmartin.

10/22/07 01:04:22 changed by tobie

  • status changed from new to closed.
  • resolution set to fixed.

(In [7986]) prototype: Prevent a Firefox bug from throwing errors on page load/unload. Closes #5393, #9421.