Sorry Elliot, but by now you have to expect this kind of answer from me /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
Try this:
Works in Safari like a charm /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />
Haha...I thought that's the kind of response I'd get.
Though, I wrote the rest of the script over Prototype and I really don't want to throw another one in (especially as once I get this bug fixed I thought I might just upload it and distribute it as a package). It's actually my contact form, you can see it in action over there.
Prototype does have an Event.stop(), but it doesn't work in Safari either. What I just posted up top is what Particletree recommended, and strangely enough it does seem to work with the click event, but not a submit.
Oh Dustin, I went through the YUI Event Utility and grabbed it's stop event function, threw it in my script...and it worked in all browsers except for Safari. You can see it for yourself on the page I linked to in the post above.
Is there some weird 'submit' event bug in Safari that everybody knows about but me?
Safari doesn't drop the default event handler for onclick unless you explicitly set obj.onclick = something/null. It's a bug in the browser, quite well known and has been posted about here before. I'm pretty sure that's what the Yahoo! code does with Safari (and Konqueror too).
Then why didn't this work?
I also tried this:
Then I called this.stop(event) from another method. Both of these worked in FF, Opera, and IE...but not Safari.
this really is the most trivial of all things. Try this:
Turns out you don't even need an HTMLElement Reference. I just straight up put test.onsubmit (assuming it's getting 'test' from the name
I've been banging my head on the keyboard and I'm still not any closer to figuring this out. I've got this:
var foo = $('emailmeform'); // basically document.getElementById
foo.onsubmit = function() {return false;}; // returns false in everything but Safari
Yet Safari won't stop the event. So I threw an alert() into there:
var foo = $('emailmeform');
foo.onsubmit = function() {alert('bla'); return false;};
And the alert isn't executing either, so I can't figure out why Safari won't execute the line?
Elliot Swan |