Bug 49424 - Calling actions twice for <input type="submit" /> and <button type="submit" /> in a <form>
Summary: Calling actions twice for <input type="submit" /> and <button type="submit" /...
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 39021
  Show dependency treegraph
 
Reported: 2010-11-11 21:22 PST by Dai Mikurube
Modified: 2011-05-31 21:11 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dai Mikurube 2010-11-11 21:22:26 PST
How to reproduce:

<form action="javascript: handler()" method="get">
<button id="pass1" type="submit" />
<input id="pass2" type="submit" />
</form>
<script>
var count = 0;

function handler()
{
    count++;
}

var input = document.getElementById('pass2');
input.click();
console.log(count);
</script>


Expected:
count will be 1 after input.click();

Actual:
count will be 2.
Comment 1 Dai Mikurube 2010-11-11 21:49:44 PST
For more details,

handler() was incorrectly called twice in case of clicking passC2, passD1, passE1, passE3, passF2 and passG3. Otherwise once.

I guess that clicking <input type="submit"> coexisting with other <button type="submit">s causes double calling.

<form action="javascript: handler()" method="get">
<input id="passA1" type="submit" />
<input id="passA2" type="submit" />
</form>
<form action="javascript: handler()" method="get">
<button id="passB1" type="submit" />
<button id="passB2" type="submit" />
</form>
<form action="javascript: handler()" method="get">
<button id="passC1" type="submit" />
<input id="passC2" type="submit" />
</form>
<form action="javascript: handler()" method="get">
<input id="passD1" type="submit" />
<button id="passD2" type="submit" />
</form>
<form action="javascript: handler()" method="get">
<input id="passE1" type="submit" />
<button id="passE2" type="submit" />
<input id="passE3" type="submit" />
</form>
<form action="javascript: handler()" method="get">
<button id="passF1" type="submit" />
<input id="passF2" type="submit" />
<button id="passF3" type="submit" />
</form>
<form action="javascript: handler()" method="get">
<button id="passG1" type="submit" />
<button id="passG2" type="submit" />
<input id="passG3" type="submit" />
</form>
Comment 2 Alexey Proskuryakov 2010-11-12 12:13:12 PST
We have many bugs about this, and most or all likely have a single root cause.

See bug 13012, bug 34315, bug 33513, bug 9715. There are probably more, dglazkov may remember those.
Comment 3 Dimitri Glazkov (Google) 2010-11-12 12:21:10 PST
(In reply to comment #2)
> We have many bugs about this, and most or all likely have a single root cause.
> 
> See bug 13012, bug 34315, bug 33513, bug 9715. There are probably more, dglazkov may remember those.

Yep. See https://bugs.webkit.org/showdependencytree.cgi?id=39021 for a full-on overview of the problem. More importantly, if you wish to contribute cycles into the effort, I'd be more than happy to help with guidance.
Comment 4 Dai Mikurube 2010-11-14 21:24:59 PST
(In reply to comment #3)
Hi Dimitri, Alexey,

Thank you for letting me know. I posted it since I just found the behavior with <input>s and <button>s when working for other bugs.

It looks like having a deep cause... I'll try it after finishing other bugs which I'm contributing to.
Comment 5 Dai Mikurube 2010-12-01 20:07:24 PST
(In reply to comment #4)
I'll be starting to work on them.
Comment 6 Dai Mikurube 2010-12-02 22:53:50 PST
(In reply to comment #5)
I found it works correctly on the current version, great! (I still couldn't find which patch fixed this bug.)


I'll be starting on the bugs at https://bugs.webkit.org/showdependencytree.cgi?id=39021 .

Dimitri, I'm wondering if you could give me a kind of guidance about "a single root cause" of them...