Samuel Sjöberg's weblog

Skip to navigation

Problems with Prototype and Safari

I have problems with capturing click events in Safari. It seems like there is a problem with the Event.stop() function, or possibly the registration of events. I have put together a simple test case.

I have only noted this behavior in Safari. I have used other methods to attach/detach events earlier and these experienced the same type of problem in Safari. It is only links that are affected by this (try the button in the example).

Using obj.onclick = function() solves the problem, but I don't like the fact that something is broken. Using onclick also breaks the other event methods in prototype if you don't fix it in the executed function:

$('obj').onclick = function(e) {
   e = window.event || e; // MSIE fix

I don't know if there is a solution to this problem. Maybe you are not supposed to use links in AJAX applications? I believe links should be used a lot in AJAX because this is the best way to make it unobtrusive.

Update: Added a short explanation to the test case and enumerated the tests to make it easier to reference to them.

Pages linking to this entry

Pingback is enabled on all archived entries. Read more about pingback in the Pingback 1.0 Specification.

About this post

Created 30th October 2005 19:44 CET. Filed under Javascript and DOM.

0 Pingbacks