Closed Bug 448591 Opened 16 years ago Closed 16 years ago

menu's appendItem sets menuitem attributes, not properties

Categories

(Core :: XUL, defect)

1.9.0 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 250123

People

(Reporter: hello, Unassigned)

Details

I have a menu to which I'm adding some items with appendItem:

let menu = document.getElementById("sync-tabs-menu");
let menuitem = menu.appendItem(label, virtualTab.id);

At this point, menuitem.label and menuitem.value are both undefined (both label and virtualTab.id are defined).  However, menuitem.getAttribute("label") and menuitem.getAttribute("value") both work as expected.

I poked around in toolkit/content/widgets/menu.xml and friends, I see that appendItem (insertItemAt, actually) will just set the attribute.  I also see that the inherited properties for value/label *should* be pulling the values out of the attribute.

So unfortunately I don't know how to explain why it doesn't work.  I've also attempted to wait for a bit after creation to poke the properties (several seconds), but that doesn't seem to help.  So it's not some sort of late/asynchronous binding problem IMO.
Component: XP Toolkit/Widgets: Menus → XUL
QA Contact: xptoolkit.menus → xptoolkit.widgets
Same issue as bug 250123?
Quite possibly.  In my case I wasn't using a listbox (I used a menu instead), but like in bug 250123 the items in my menu were not visible.  I was building up a menu without showing it.

Marking as a dupe.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.