I am wondering is the following behavior correct.
I have a label element linked to an input element via the “for” attribute, should this yield two click events on a single user click on the label? Specifically, put a click listener on window. Then, define checkbox with a label element linked to it using attribute “for”. Click on the label text. The result is that checkbox will be checked and you will see two click events. http://jsfiddle.net/k55uD/2/
If this behavior is correct, are there more such cases, attributes, or whatever? Some spec would be nice.
Any help is appreciated.
P.S. I update the post with the example.
Clicking the
labelwill trigger anyonclickfunction attached to thatlabeland anyonclickattached to theinputitself. Clicking theinputwill trigger only theonclickfor theinput.This is very easy to test. See here: