Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

safari not running preventDefault and stopPropagation



Hi there,

I'm attempting to use preventDefault and stopPropagation and I'm running into an odd problem.

I found this demo page which seems to successfully use both of these functions to stop a default event occuring:
http://www.peterblum.com/SafariBugs/CancelKeyPress.html


But when I try to employ them in my scripts, I find that Safari ignores them:
http://demo.1976design.com/preventdefault/


In fact, it doesn't completely ignore them, because I first check to see if Safari understands them:

if (e && e.preventDefault && e.stopPropagation)

And it does. It's when I attempt to run these functions, that nothing happens:

if (e && e.preventDefault && e.stopPropagation)
{
// safari gets inside this if statement, but then fails to execute the following two lines
e.preventDefault();
e.stopPropagation();
// this alert is executed, however
alert("link should be dead");
}


Does anyone have any suggestions as to what I can do?

Many thanks -- Dunstan Orchard
_______________________________________________
web-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/web-development
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.