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

ASSIGNED
Assigned to

Status

()

Core
XUL
ASSIGNED
10 years ago
6 years ago

People

(Reporter: Pawel Chmielowski, Assigned: Pawel Chmielowski)

Tracking

Trunk
x86
All
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

10 years ago
Created attachment 331778 [details]
Example of broken behaviour

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.
(Assignee)

Comment 1

10 years ago
Created attachment 331781 [details] [diff] [review]
v1

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

Updated

10 years ago
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 3

6 years ago
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 4

6 years ago
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 6

6 years ago
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-

Comment 7

6 years ago
Pawel, Mike, can you continue with the patch according to this info?
You need to log in before you can comment on or make changes to this bug.