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.
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>
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.
(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.
(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.
(In reply to comment #4) I'll be starting to work on them.
(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...