persist should be able to remove an attribute from an element. Currently persist
saves the value of an attribute to the localstore.rdf file only if there is an
attribute. We need a way to save the fact that there is no attribute so that
when the document is built the next time it can remove an attribute that is set
by default in the XUL. We currently use checked="true" on menu items that must
persist, the problem comes in when we remove this attribute to remove the
checkmark, nothing is saved to the localstore.rdf file, so the next time this
window is displayed it does not get the checked="true" removed from the element.
We need to fix globalOverlay.js when this is fixed, to remove the hack of setting
any chance of this being done in the near future? it's really annoying when
trying to create checkbox menuitems that use persist to save their values. The
only workaround is to use the prefs file, which is really cumbersome. This will
prevent companies attempting to add menus for their employees from using such
menus, which could be a major problem with acceptence. Recommend fixing before PR3.
nominating nsbeta3, because of above reasons.
This would be a great feature to have, but I'm not going to be able to get to it
I no longer see a checked="false" hack in any of the globalOverlay.js files in the repository, but setting autocheck="false" on the menuitem, then manually setting the attribute to "false" when the menuitem is unchecked (i.e. doing menuitem.setAttribute("checked", "false") instead of menuitem.removeAttribute("checked")), correctly hides the checkmark and enables the persistence of that state.
I have added a note about this workaround to the menuitem entry in the XUL reference <http://developer.mozilla.org/en/docs/XUL:menuitem>.
> I have added a note about this workaround to the menuitem entry in the XUL
> reference <http://developer.mozilla.org/en/docs/XUL:menuitem>.
This works now? I have a situation where I removed a persisted attribute and it is not present when I start a new session. The attribute is on a box in my own dialog window and set attributes persist.
(In reply to Ian Nartowicz from comment #7)
> This works now? I have a situation where I removed a persisted attribute
> and it is not present when I start a new session.
Any update on this? I am observing the same thing (persisting of no checked attribute), but I don't want to rely on it until I have verification from the devs.