OS X Sleep: Hibernate or one eye open. Why I listen to the BBC at work…
Apr 24

Safari Issue: Cascading of mouse events and why input type=”submit” wasn’t working

JavaScript, Tech Add comments

For some reason the submit button on a search widget wasn’t submitting under Safari. It works totally fine in the other browsers, but Safari? nothing.

Hmm. The onsubmit event wasn’t even getting called. You click the button, and nothing.

Is it one of the annoying bugs to do with naming the submit button or something lame like that?

Nope, this one turned out to be due to an event handler placed on the body element:

document.getElementsByTagName(”body”).item(0).onclick = function() {}

Safari would take this click and call this function, and wouldn’t run the click event that the submit button has intrinsically.

Of course, the line of code above didn’t actually exist, it was created via the myriad of JavaScript libraries that this web application was using.

2 Responses to “Safari Issue: Cascading of mouse events and why input type=”submit” wasn’t working”

  1. Sam Pullara Says:

    So what’s the correct behavior? Should handled events be cascaded to underlying components? I kinda doubt it in general, maybe this is some sort of workaround?

  2. verda Says:

    I am writing this in July 2008. Has no one figured a solution for this problem yet? I encountered it today on the latest version of Safari and need to fix it ASAP!

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: What is the number before 3? (just put in the digit)