Can't set 'checked' property of <Input type=checkbox > while loading a page

RESOLVED FIXED

Status

()

Core
Layout: Form Controls
RESOLVED FIXED
17 years ago
16 years ago

People

(Reporter: Ivan Sagalaev, Assigned: John Keiser (jkeiser))

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

17 years ago
First look into the source of the URL - it's self-explanatory.
Here goes a description:
The page creates a form with 3 checkboxes. Then inline JavaScript tries to set
each checkbox' 'checked' to 'true' and fails.
After 3 seconds the same JavaScript code is called again (through setTimeout)
and works good.

P.S. When I insert, say, window.alert(elements[i]) before setting 'checked' the
code works good for the first time too.
(Reporter)

Updated

17 years ago
Component: Form Manager → HTML Form Controls

Comment 1

17 years ago
Reassigning
Assignee: morse → rods
QA Contact: tpreston → madhur
confirming on linux 2002-01-19-21.  jkeiser?
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → All
Hardware: PC → All
(Assignee)

Comment 3

17 years ago
The problem is probably that the frame doesn't exist yet.  Pretty sure this will
go away with bug 108308.
Depends on: 108308

Comment 4

17 years ago
->>
Assignee: rods → jkeiser
(Reporter)

Comment 5

17 years ago
Interesting note: if I use elements[i].setAttribute('checked') instead of
setting directly elements[i].checked=true everything works.

Does Mozilla use different APIs for accessing a property directly or through a
DOM method?
.checked and setAttribute("checked") do entirely different things.  One sets an
attribute on a node (equivalent to actually editing the HTML).  The other
changes the value of a DOM property.  The fact that the initial value of the DOM
property is decided based on the value of the attribute is the only thing that
ties the two together.
(Reporter)

Comment 7

17 years ago
Thanks for explanation.

My misunderstanding was because I've seen the .checked property on a W3C in the
DOM1 spec. I did think that setting properties through setAttribute or
propertie's  corresponding interface should differ just in syntax... Now I see
the true difference :-)
(Assignee)

Comment 8

17 years ago
Oops, I set the dependency wrong before, it was bug 108307, which has landed,
and fixed this bug with it.
Status: NEW → RESOLVED
Last Resolved: 17 years ago
Depends on: 108307
No longer depends on: 108308
Resolution: --- → FIXED

Updated

16 years ago
QA Contact: madhur → tpreston
You need to log in before you can comment on or make changes to this bug.