Bug 52149
Summary: | Returning false from onsubmit with image maps doesn't suppress coordinates | ||
---|---|---|---|
Product: | WebKit | Reporter: | Adam Langley <agl> |
Component: | Forms | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | ap, dglazkov, royce.williams, tkent, tony |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | PC | ||
OS: | All |
Adam Langley
There is apparently a common idiom for suppressing the submission of coordinates from an image map which doesn't work in WebKit. This bug report is taken from [1].
Reproduces in Chrome nightly and Safari.
[This is a common idiom] to work around imagemap behavior:
onsubmit="this.submit(); return false;">
This prevents submit.x and submit.y from showing up in the resulting URL (because the browser, when the image is clicked, appends to the URL the X and Y coordinates of the pixel clicked within the image)
Here is your example, modified to capture this usage:
<html>
<head>
<script>
function f() {
return false;
}
</script>
</head>
<body>
<form method="GET" action="/" onsubmit="this.submit(); return f();">
<input type="text" name="test">
<input type="image" src="dummy.gif" alt="Submit" title="Submit" />
</form>
</body>
</html>
The following browser/OS combos exhibit the symptom described by the original poster in my testing, using exactly the code above:
* Chrome 9.0.597.19 on Ubuntu 10.04 x86 (Firefox 3.6.13 works as expected)
* Chrome 9.0.576.0 on recent Windows XP (IE8 works as expected; FF 3.6.13 passes x=0, y=0 regardless of where clicked)
* Chrome 10.0.612.1 on Windows 7 Home Premium (IE8 and FF 3.6.13 work as expected)
Both returning false directly in the onsubmit action, as well as calling a function that returns false, produce the symptom.
These references contain workarounds using CSS or Javascript:
stackoverflow.com/questions/1244009
www.webmasterworld.com/html/3545351.htm
Unfortunately, they are workarounds that sidestep using images as a "image" input types, and do not address the underlying "return false" issue.
[1] http://www.google.com/support/forum/p/Chrome/thread?fid=7abe8874e21c2d8e0004995f2b6c53bd&hl=en
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
Looks like a duplicate of bug 13012, or one of the many other bugs we track on nested submission.