Closed Bug 386482 Opened 17 years ago Closed 17 years ago

Add a setter for richlistitem.searchLabel

Categories

(Toolkit :: UI Widgets, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha8

People

(Reporter: zeniko, Assigned: zeniko)

References

Details

Attachments

(1 file)

(to conform to expectations due to similar properties and to the foresightful documentation)
Attached patch fixSplinter Review
Not sure whether a way to revert to the default value is really needed, but |item.searchLabel = null| seems nicer than |item.removeAttribute("searchlabel")| and more in line with |item.searchLabel = "find me"| and |item.searchLabel = ""|.
Assignee: nobody → zeniko
Status: NEW → ASSIGNED
Attachment #270478 - Flags: review?(enndeakin)
Comment on attachment 270478 [details] [diff] [review]
fix

>+            if (val !== null)
>+              this.setAttribute("searchlabel", val);

Just use if (val)
Attachment #270478 - Flags: review?(enndeakin) → review+
Due to the the way the getter works, there are three different cases:

item.searchLabel = "text" // FAYT tries to match "text"
item.searchLabel = ""     // FAYT never selects this item
item.searchLabel = null   // FAYT tries to match item.label

Using |if (val)| instead of |if (val !== null)| would prevent the second case, i.e. excluding an item from FAYT by giving it an empty searchlabel.

Should you not want to allow the second case, the getter would have to be rewritten to |return this.getAttribute("searchlabel") || this.label;|.
Whiteboard: [checkin needed]
Checking in toolkit/content/widgets/richlistbox.xml;
new revision: 1.40; previous revision: 1.39
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Whiteboard: [checkin needed]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: