Closed cpboyd closed 8 years ago
How are you adding your elements? This definitely works: http://jsbin.com/pusoja/1/edit?html,output
You need to make sure that you're using Polymer.dom(yourMenu).appendChild(newItem)
instead of regular DOM methods, since the correct observers need to fire.
Closing, as this is working. Please re-open if you still have issues, and provide a JSBin with reproducible steps for your problem
@notwaldorf
I just realized that it seems the issue is more that paper-menu needs to override iron-selector's default functions, since paper-menu nests content within a div.
Polymer.dom(node).observeNodes()
doesn't seem to monitor a child's children.
I've modified a behavior to account for this: https://github.com/cpboyd/paper-menu-input/blob/master/paper-menu-input-behavior.html
By doing this, I'm able to easily add paper-items to the menu/menubar from a JSON array.
If you mean that iron-selector
only tracks immediate children, then yes, you're right; this is being tracked in https://github.com/PolymerElements/iron-selector/issues/42. :)
Ah. Thanks for that reference.
No worries!
With paper-menu, I've tried adding paper-items to the menu after creation to no avail.
If the iron-selector could automatically update its item list, then it would be possible to utilize a JSON array (and a
dom-repeat
) to initialize an iron-selector element's items.