Closed
Bug 250817
Opened 20 years ago
Closed 20 years ago
nsWidgetStateManager assumes first element returned by getElementsByAttribute is its child
Categories
(Core :: XUL, defect)
Core
XUL
Tracking
()
RESOLVED
FIXED
People
(Reporter: iannbugzilla, Assigned: iannbugzilla)
References
Details
Attachments
(3 files, 3 obsolete files)
3.36 KB,
patch
|
iannbugzilla
:
review+
jag+mozilla
:
superreview+
|
Details | Diff | Splinter Review |
3.35 KB,
patch
|
mconnor
:
review+
|
Details | Diff | Splinter Review |
3.37 KB,
patch
|
Details | Diff | Splinter Review |
If you have nested radio groups like below: <radiogroup id="groupone"> <radio value="0" label="Option A for Group 1"/> <radiogroup id="grouptwo" style="margin-left: 2em"> <radio value="0" label="Option A for Group 2"/> <radio value="1" label="Option B for Group 2"/> </radiogroup> <radio value="1" label="Option B for Group 1"/> </radiogroup> where you use the same set of values for both radiogroups. When nsWidgetStateManager.js, in the set_Radiogroup function, tries to set the "Option B for Group 1" radio button it sets the "Option B for Group 2" button instead because that is the first element it finds with the value of 1.
Checks id of parentNode to make sure it's a child and not a grandchild, etc
Attachment #152804 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 2•20 years ago
|
||
To fix this properly you'd probably want to iterate over the radio children as computed by radio.xml - perhaps by enhancing the "value" setter?
Attachment #152804 -
Flags: review?(neil.parkwaycc.co.uk)
Borrows from rest of setters in radio.xml, not too sure what best to do with invalid values - whether to throw an exception or just report an error and continue with other radiogroups.
Attachment #152804 -
Attachment is obsolete: true
Attachment #153226 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 4•20 years ago
|
||
Comment on attachment 153226 [details] [diff] [review] Patch v0.2 >+ throw new Error("Invalid value for radiogroup - has to be the value of one of its children"); I don't think this is a good idea. For instance, menulists simply set the attribute as the given value even if a new selection cannot be made. This would then simplify your shortcut code above as you could just see if the attribute is the same and return early if it is.
Attachment #153226 -
Flags: review?(neil.parkwaycc.co.uk) → review-
Takes on board Neil's comments Value attribute can sometimes already have the correct value without the corresponding item being selected so no easy way to return early.
Attachment #153226 -
Attachment is obsolete: true
Attachment #153457 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 6•20 years ago
|
||
Comment on attachment 153457 [details] [diff] [review] Patch v0.3 >+ this.setAttribute('value', val); Hmm... is local style to use single or double quotes inside CDATA? >+ var children = this._getRadioChildren(); >+ for (var i = 0; i < children.length; i++) { >+ if (children[i].value == val) { >+ this.selectedItem = children[i]; >+ return val; break perhaps? I need to think about this during the day ;-) >+ } >+ } >+ return val;
Both styles are used, there may be slightly more use of " than ' but not decisively so. Would using break mean a tidier exit from the setter?
Comment 8•20 years ago
|
||
Comment on attachment 153457 [details] [diff] [review] Patch v0.3 I've trawled the rest of the bindings and the style does seems to lean towards double quoted strings in CDATA and break over early return.
Attachment #153457 -
Flags: review?(neil.parkwaycc.co.uk) → review+
Changed ' to " and used break instead of returning early as per Neil's comments
Attachment #153457 -
Attachment is obsolete: true
Assignee | ||
Comment 10•20 years ago
|
||
Comment on attachment 153533 [details] [diff] [review] Patch v0.3a - Tweaked version of patch v0.3 Carrying forward r+ and requesting sr
Attachment #153533 -
Flags: superreview?(bryner)
Attachment #153533 -
Flags: review+
Assignee | ||
Comment 11•20 years ago
|
||
To keep things in sync if it is wanted
Attachment #153534 -
Flags: review?(mconnor)
Comment 12•20 years ago
|
||
Comment on attachment 153534 [details] [diff] [review] Firefox version of patch 0.3a looks good. I like when Neil reviews this stuff first, makes my job easier.
Attachment #153534 -
Flags: review?(mconnor) → review+
Attachment #153534 -
Flags: superreview?(bryner)
Updated•20 years ago
|
Flags: blocking1.8a3? → blocking1.8a3-
Attachment #153533 -
Flags: superreview?(bryner) → superreview?(jag)
Attachment #153534 -
Flags: superreview?(bryner)
Attachment #153534 -
Flags: approval-aviary?
Assignee | ||
Comment 13•20 years ago
|
||
toolkit version of patch (bug250817patch0_3af) checked into trunk Checking in widgets/radio.xml; /cvsroot/mozilla/toolkit/content/widgets/radio.xml,v <-- radio.xml new revision: 1.9; previous revision: 1.8 done Checking in nsWidgetStateManager.js; /cvsroot/mozilla/toolkit/content/nsWidgetStateManager.js,v <-- nsWidgetStateManager.js new revision: 1.8; previous revision: 1.7 done
Comment 14•20 years ago
|
||
Comment on attachment 153533 [details] [diff] [review] Patch v0.3a - Tweaked version of patch v0.3 sr=jag
Attachment #153533 -
Flags: superreview?(jag) → superreview+
Assignee | ||
Comment 15•20 years ago
|
||
xpfe version of patch (bug250817patch0_3a) checked into trunk Checking in bindings/radio.xml; /cvsroot/mozilla/xpfe/global/resources/content/bindings/radio.xml,v <-- radio.xml new revision: 1.34; previous revision: 1.33 done Checking in nsWidgetStateManager.js; /cvsroot/mozilla/xpfe/global/resources/content/nsWidgetStateManager.js,v <-- nsWidgetStateManager.js new revision: 1.29; previous revision: 1.28 done Leaving open for aviary checkin if needed.
Attachment #153534 -
Flags: approval-aviary?
Assignee | ||
Comment 16•20 years ago
|
||
Revised patch that includes fixes to this bug and bug 260357
Attachment #159429 -
Flags: review?(mconnor)
Attachment #159429 -
Flags: approval-aviary?
Comment 17•20 years ago
|
||
Comment on attachment 159429 [details] [diff] [review] Aviary version of patch - includes fix to bug 260357 let's get review before considering for approval.
Attachment #159429 -
Flags: approval-aviary?
Updated•20 years ago
|
Flags: blocking-aviary1.0? → blocking-aviary1.0-
Assignee | ||
Comment 18•20 years ago
|
||
Comment on attachment 159429 [details] [diff] [review] Aviary version of patch - includes fix to bug 260357 Carrying forward r's from this and bug 260357
Attachment #159429 -
Flags: review?(mconnor) → review+
Comment 19•20 years ago
|
||
Comment on attachment 159429 [details] [diff] [review] Aviary version of patch - includes fix to bug 260357 don't need this on aviary branch, especially at this stage.
Attachment #159429 -
Flags: review+
Assignee | ||
Comment 20•20 years ago
|
||
Resolving as fixed as it's not required for aviary branch.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 21•20 years ago
|
||
Needs to be relanded once aviary branch has landed on trunk (possibly)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Whiteboard: reland-irsn
Assignee | ||
Comment 22•20 years ago
|
||
Patch re-checked in Checking in widgets/radio.xml; /cvsroot/mozilla/toolkit/content/widgets/radio.xml,v <-- radio.xml new revision: 1.13; previous revision: 1.12 done Checking in nsWidgetStateManager.js; /cvsroot/mozilla/toolkit/content/nsWidgetStateManager.js,v <-- nsWidgetStateManager.js new revision: 1.10; previous revision: 1.9 done
Keywords: aviary-landing
Assignee | ||
Comment 23•20 years ago
|
||
Fixed
Status: REOPENED → RESOLVED
Closed: 20 years ago → 20 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Keywords: aviary-landing
Whiteboard: reland-irsn
You need to log in
before you can comment on or make changes to this bug.
Description
•