This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
https://html.spec.whatwg.org/multipage/forms.html#the-input-element:concept-fe-checked https://html.spec.whatwg.org/multipage/forms.html#attr-input-checked Currently, setting the `checked` content attr for an input element sets the IDL attribute too (via proxy of the "checkedness"), however the reverse is not true -- so we can pull the rug under the checked content attr and make it not reflect the true state of the checkbox. Additionally, changing the checked state via a click does not affect the content attribute, only the checkedness[1], giving a similar effect. Modern browsers, however, have the `checked` content attr reflecting the actual checked state -- should the spec be updated to do this? A simple note that "setting the checkedness should ensure that the corresponding content attr is updated" should do. [1]: https://html.spec.whatwg.org/multipage/forms.html#checkbox-state-%28type=checkbox%29:pre-click-activation
Do you have a test showing where browsers differ from the spec?
Created attachment 1552 [details] test.html Hm, I'm getting even stranger behavior. I take an initially checked checkbox, and then click it followed by removing the content attr. Chrome does this: Initially, content attr is: true Initially, IDL attr is: true After clicking, content attr is: true After clicking, IDL attr is: false After removing content attr, IDL attr is: false Firefox does this: Initially, content attr is: true Initially, IDL attr is: false After clicking, content attr is: true After clicking, IDL attr is: true After removing content attr, IDL attr is: true O.o
(Unless I'm missing something you didn't upload the test, you uploaded the results. Can you upload the test or provide a link to it?) By "content attr is: true" I assume you mean "content attr is present". By "IDL attr" I assume you mean the "checked" IDL attribute, not the "defaultChecked" IDL attribute. (Note that the checked="" content attribute is reflected by the .defaultChecked IDL attribute, not the .checked IDL attribute. The latter merely describes the current state of the element. The current state is not reflected into the DOM.) Assuming so, then Firefox is definitely wrong. If the checkbox appears checked, then the IDL "checked" attribute should be true. I am surprised by what you describe, though, I cannot reproduce it: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/3321 What you describe as Chrome's behaviour is, from what I can gather of the test you're describing, correct according to the spec.
Manish, the content checked attribute is reflected by defaultChecked. The checked IDL attribute is about the current state.