Confusing bugs

I love bugs that are just confusing and/or break your mental model of how you think the software works.

Here is a good example: Given the following HTML in Gecko, what happens when a user clicks the button?

<form method="POST" action="/form-action">
  <a href="/anchor-target">
    <input type="button" value="harro">
  </a>
</form>
GET /anchor-target HTTP/1.1
GET /anchor-target HTTP/1.1

2 GET requests? Okay, perhaps some sort of event bubbling problem; it's relatively common in GUI internals. But what about:

<form method="POST" action="/form-action">
  <a href="/anchor-target">
    <input type="image" src="http://upload.wikimedia.org/wikipedia/en/7/75/LHC5.jpg">
  </a>
</form>
POST /form-action HTTP/1.1
GET /anchor-target HTTP/1.1
GET /anchor-target HTTP/1.1

Wait, this time it POSTs the form and makes 2 GET requests?

Answers in a Bugzilla report, thanks.

Comments (3)

From the HTML spec:
`TYPE=IMAGE' implies `TYPE=SUBMIT' processing; that is, when a pixel is chosen, the form as a whole is submitted.

i.e. the POST request in the second case is not a bug. The only bug I can see here is the duplicated GET.

Nov. 5, 2009, 2:11 p.m. #
Sorry, did you misread? In case it wasn't clear from my post, the interesting question is why are we seeing two GETs as *as well as* a single POST.
James Ross

Looks like https://bugzil… and https://bugzil…, but wow, very weird.

Nov. 5, 2009, 8:22 p.m. #
Anonymous

If you s/button/submit/ in the first example, do you also get a POST and two GETs?

By the way, note that your example violates HTML5, at least: an "a" element cannot contain interactive content, which includes any input with type other than hidden.

Nov. 5, 2009, 8:50 p.m. #