Bug 15581 - Event handler ambiguity
Summary: Event handler ambiguity
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 523.x (Safari 3)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://junkyard.damowmow.com/299
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-20 15:26 PDT by George Staikos
Modified: 2007-10-23 01:13 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description George Staikos 2007-10-20 15:26:50 PDT
This code seems to behave differently in every browser I tested, and behavior in WebKit has been changing between versions.  What should we be doing?

<html><head><title>pressed</title>
<script type=text/javascript>
function ev_onclick()
{
        document.write("Generated from script 1");
}

function ev_onsubmit()
{
        document.write("Generated from script 2");
}
</script>

<body>
<form onsubmit=ev_onsubmit() action="" method=post><input onclick=ev_onclick() type=submit value="Submit Query">
</form><br>
</body></html>
Comment 1 David Kilzer (:ddkilzer) 2007-10-20 19:32:44 PDT
(In reply to comment #0)
> This code seems to behave differently in every browser I tested, and behavior
> in WebKit has been changing between versions.  What should we be doing?

What does each browser do that you've tested?
Comment 2 George Staikos 2007-10-20 20:49:27 PDT
Firefox displays the submit handler and loads forever
Opera, Konqueror display the submit handler and stop
Safari 2 goes blank
WebKit recent trunk goes back to the form
Comment 3 Ian 'Hixie' Hickson 2007-10-23 01:11:23 PDT
The click ev_onevent() function should fire first when you click the button. It replaces the document with a new document, and that ends that. So you should end up with a document that just says "Generated from script 1".

Ok so I wrote that based on just my knowledge of HTML5. Now for reality. I tested IE7 and Mozilla trunk, and luckily for my credibility, both do exactly what I just described. Score!