FF 3.1 toolbarpalette compatibility - Mozilla

This is a discussion on FF 3.1 toolbarpalette compatibility - Mozilla ; Ciao all, I have an issue with 3.1, due to the "Firefox 3.1 Note" in this DOC: https://developer.mozilla.org/en/XUL/toolbar My problem is that, in 3.0, I successfully managed to programmatically add / remove a toolbar item from the toolbarpalette to the ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: FF 3.1 toolbarpalette compatibility

  1. FF 3.1 toolbarpalette compatibility

    Ciao all,

    I have an issue with 3.1, due to the "Firefox 3.1 Note" in this DOC:

    https://developer.mozilla.org/en/XUL/toolbar

    My problem is that, in 3.0, I successfully managed to programmatically
    add / remove a toolbar item from the toolbarpalette to the navbar,
    even
    multiple times. Now, in 3.1, since toolbar items are MOVED from the
    toolbarpalette, and no longer COPIED, the framework I wrote doesn't
    work anymore. In fact:

    1) first time item is added through:

    var navbar = document.getElementById("nav-bar");
    navbar.insertItem("my-item", null);

    everything is fine, since "my-item" is in the toolbarpalette (I omit
    the code
    for persisting the navbar currentSet, since it is not related to the
    issue)

    2) everything is fine also when item is removed through:

    var navbar = document.getElementById("nav-bar");
    var item = (navbar.getElementsByAttribute("id", "my-item"))[0];
    navbar.removeChild(item);

    3) but then, when item is re-added doing 1) again, insertItem fails
    because "my-item" is no longer in toolbarpalette (FF 3.1 moved it, not
    copied it).

    I thought I modified the code in 2) to readd the item to the
    toolbarpalette
    by doing:

    var navbar = document.getElementById("nav-bar");
    var item = (navbar.getElementsByAttribute("id", "my-item"))[0];
    document.getElementById("BrowserToolbarPalette").appendChild
    (navbar.removeChild(item));

    but document.getElementById("BrowserToolbarPalette") returns NULL.....

    any help anybody?

    thanks

    m



  2. Re: FF 3.1 toolbarpalette compatibility

    On Apr 11, 1:34*am, Neil wrote:
    > marco wrote:
    > >Now, in 3.1, since toolbar items are MOVED from the toolbarpalette, and no longer COPIED, the framework I wrote doesn't work anymore.

    >
    > Rather then writing your own framework, why not use the currentSet
    > property, whose behaviour remains the same?
    >
    > --
    > Warning: May contain traces of nuts.



    Ciao Neil, thanks for the reply.

    Sorry, my first message wasn't very clear:

    I do use the currentSet, after I use insertItem, that is:

    var navbar = document.getElementById("nav-bar");
    navbar.insertItem("my-item", null);
    navbar.setAttribute("currentset", navbar.currentSet);
    document.persist("nav-bar", "currentset");

    As well, to remove the added item:

    var navbar = document.getElementById("nav-bar");
    var item = (navbar.getElementsByAttribute("id", "my-item"))[0];
    navbar.removeChild(item);
    navbar.setAttribute("currentset", navbar.currentSet);
    document.persist("nav-bar", "currentset");

    Everything works fine, but if I try to re-add the item the
    second time, this call fails:

    navbar.insertItem("my-item", null);

    because in FF 3.1 'my-item' has been MOVED from the
    toolbarpalette when added first time, not copied as in FF 3.0,
    so second call to insertItem doesn't find it.

    So, regardless of currentSet, the question is: how do I re-add
    'my-item' to the toolbarpalette once I remove it from the navbar,
    so that a subsequent call to insertItem will work ok?

    Thanks

    m

+ Reply to Thread