Closed Bug 53860 Opened 24 years ago Closed 24 years ago

HTML <input type="checkbox"/> has no checked value (also radio)

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla0.8

People

(Reporter: murphy, Assigned: jst)

Details

(Whiteboard: [HAVE FIX])

Attachments

(2 files)

Tested with build 2000091212 As I understand it, if a checkbox (or radio) even has a checked attr node, then it is in fact checked. Taking that further, if we use XHTML checked="checked" also means that it is checked. The problem is that when the checked attr node is created using the DOM, it does not affect the checkbox. Also, if I try to give the checked node a "checked" value, it only will return a "" string. Finally, physically clicking on the checkbox does not affect the DOM either. It does not even create the attr node. Try commenting out the load() lines to test that. IE uses this weird true/false scenario. Here is the code, and it is also attached: <html> <script> function load() { // Should check the box during load document.getElementById("save").setAttribute("checked","checked"); // Should return "checked" alert(document.getElementById("save").getAttribute("checked")); // It will return the attr object however alert(document.getElementById("save").getAttributeNode("checked")); } function unload() { // After clicking, should also return "checked" alert(document.getElementById("save").getAttribute("checked")); // After clicking, should also return "checked" alert(document.getElementById("save").getAttributeNode("checked")); } </script> <body onload="load();"> <form> <input type="checkbox" onclick="unload()" id="save"/> </form> </body>
Attached file testcase
Component: DOM Level 2 → DOM Level 1
When I test on Linux build 20000922, I get a blank alert box getAttribute() and "[object Attr]" for the getAttributeNode(). So I think I've confirmed the first part of the bug. I don't know enough about DOM or JavaScript to confirm the rest of it, but the rest of it might want to be in a different bug anyways.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch Proposed fix.Splinter Review
The attached patch does fix the problem but the chance of me actually getting the permission to check this in for Netscape 6.0 is very small so this'll haveto wait for post release.
Severity: critical → normal
Status: NEW → ASSIGNED
OS: Windows 2000 → All
Hardware: PC → All
Whiteboard: [HAVE FIX]
Target Milestone: --- → Future
I say, let's get this into the trunk. patch and review keywords. This should probably be re-patched against the current tree
Keywords: patch, review
I agree.
Keywords: nsbeta1
Target Milestone: Future → mozilla0.8
And now no action has taken place for 2 weeks now. Jst: Is all that needs to be done here is recreate a patch file from the trunk and get r=/sr=?
All that's needed here is r&sr=, the current patch is IMO still clear enough even if it doesn't apply (I'm not even sure it doesn't)...
Eric Pollmann sez r=pollmann.
*** Bug 12348 has been marked as a duplicate of this bug. ***
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Component: DOM Level 1 → DOM HTML
Component: DOM: HTML → DOM: Core & HTML
QA Contact: vidur → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: