Open Bug 448582 Opened 16 years ago Updated 2 years ago

Listitems with type="checkbox" doesn't work if .checked is set too early

Categories

(Core :: XUL, defect)

x86
All
defect

Tracking

()

People

(Reporter: bugz, Unassigned)

Details

Attachments

(2 files)

Listitem with checkbox can't be checked or unchecked if .checked property was set before widget was properly initialized. Situation is worsened by on first display initialization, which can quite late for items not in visible region (they are initialied when they are scrolled into view for first time).

Attached example show this bug, first item doesn't have checked set so it work correctly, next items can't be checked because they have checked set.
Attached patch v1Splinter Review
There is a bit ugly fix for this bug.

By setting .checked value before xbl widget initializes, we set "checked" slot in main object, all further changes to it just replaces this slot instead calling proper setter deeper in proto chain. This patch uses trickery to restore correct state.

Simmilar change at xbl handling level will be even better (for one it will unbroke all widgets, this is not only limited to listitem), but i guess its no go because of potential regressions.
Assignee: nobody → bugz
Status: NEW → ASSIGNED
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
For future sufferers of this bug, a simple workaround is to use:

aListItem.setAttribute("checked", true/false);

as opposed to

aListItem.checked = true/false;
Comment on attachment 331778 [details]
Example of broken behaviour

Remote XUL seems to not work anymore.
Attachment #331778 - Attachment mime type: application/vnd.mozilla.xul+xml → text/plain
Comment on attachment 331781 [details] [diff] [review]
v1

What's up with this patch? Forgot setting a request?
Attachment #331781 - Flags: feedback?(bzbarsky)
Comment on attachment 331781 [details] [diff] [review]
v1

Over to someone who might know something about this code.  But offhand, that looks horrible... ;)
Attachment #331781 - Flags: feedback?(bzbarsky) → feedback?(neil)
Comment on attachment 331781 [details] [diff] [review]
v1

Personally I think this is wontfix, but at the very least you would want to use this.hasOwnProperty("checked") rather than saving and restoring the prototype.
Attachment #331781 - Flags: feedback?(neil) → feedback-
Pawel, Mike, can you continue with the patch according to this info?

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: bugz → nobody
Status: ASSIGNED → NEW
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: