panel.openPopup method doesn't work if panel created programmatically - Mozilla

This is a discussion on panel.openPopup method doesn't work if panel created programmatically - Mozilla ; Ciao all, the following JS code throws an exception: var panel = document.createElementNS(XUL_NS, "panel"); panel.openPopup(anchor, "start_before", 0, 0, false, false); (where "anchor" is another element, visible on the screen at the moment the above code is invoked). Exception message is: ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: panel.openPopup method doesn't work if panel created programmatically

  1. panel.openPopup method doesn't work if panel created programmatically

    Ciao all,
    the following JS code throws an exception:

    var panel = document.createElementNS(XUL_NS, "panel");
    panel.openPopup(anchor, "start_before", 0, 0, false, false);

    (where "anchor" is another element, visible on the screen
    at the moment the above code is invoked).

    Exception message is:

    Error: panel.openPopup is not a function
    Source File: ....
    Line: ....

    Please note that if I define the panel within my overlay XML,
    as:

    anel id="my_panel" />

    then:

    document.getElementById("my_panel").openPopup(anchor, "start_before",
    0, 0, false, false);

    works like a charm.

    Any hint anybody?

    thanks a million

    marco

  2. Re: panel.openPopup method doesn't work if panel created programmatically

    marco wrote:
    > Ciao all,
    > the following JS code throws an exception:
    >
    > var panel = document.createElementNS(XUL_NS, "panel");
    > panel.openPopup(anchor, "start_before", 0, 0, false, false);
    >


    > (where "anchor" is another element, visible on the screen
    > at the moment the above code is invoked).
    >
    > Exception message is:
    >
    > Error: panel.openPopup is not a function
    > Source File: ....


    Because you haven't put the panel in a document yet.

  3. Re: panel.openPopup method doesn't work if panel createdprogrammatically

    Ciao neil, thanks as usual for the reply.

    sorry for another question: what would be the best
    DOM element to attach the panel to?


    2008/9/10 Neil Deakin

    > marco wrote:
    > > Ciao all,
    > > the following JS code throws an exception:
    > >
    > > var panel = document.createElementNS(XUL_NS, "panel");
    > > panel.openPopup(anchor, "start_before", 0, 0, false, false);
    > >

    >
    > > (where "anchor" is another element, visible on the screen
    > > at the moment the above code is invoked).
    > >
    > > Exception message is:
    > >
    > > Error: panel.openPopup is not a function
    > > Source File: ....

    >
    > Because you haven't put the panel in a document yet.
    > _______________________________________________
    > dev-extensions mailing list
    > dev-extensions@lists.mozilla.org
    > https://lists.mozilla.org/listinfo/dev-extensions
    >




    --

    Marco Donizelli
    Senior System Developer
    bMenu AS
    +47 41731128

  4. Re: panel.openPopup method doesn't work if panel createdprogrammatically

    On Thu, 11 Sep 2008 22:12:02 +0200, Marco Donizelli wrote:

    > Ciao neil, thanks as usual for the reply.
    >
    > sorry for another question: what would be the best DOM element to attach
    > the panel to?
    >
    >
    > 2008/9/10 Neil Deakin
    >
    >> marco wrote:
    >> > Ciao all,
    >> > the following JS code throws an exception:
    >> >
    >> > var panel = document.createElementNS(XUL_NS, "panel");
    >> > panel.openPopup(anchor, "start_before", 0, 0, false, false);
    >> >
    >> >
    >> > (where "anchor" is another element, visible on the screen at the
    >> > moment the above code is invoked).
    >> >
    >> > Exception message is:
    >> >
    >> > Error: panel.openPopup is not a function Source File: ....

    >>
    >> Because you haven't put the panel in a document yet.
    >> _______________________________________________ dev-extensions mailing
    >> list
    >> dev-extensions@lists.mozilla.org
    >> https://lists.mozilla.org/listinfo/dev-extensions
    >>


    Depending on what you want to do, it should work at least with layout elements
    such as hbox, vbox, stack, deck, ...
    Check out `XUL Element and Script Reference'[1] for a start.



    [1] XUL Element and Script Reference - http://www.xulplanet.com/references/.../quickref.html

    --
    Be excellent to each other. Party on, dudes. [Bill and Ted, 1989]

  5. Re: panel.openPopup method doesn't work if panel created programmatically

    Marco Donizelli wrote:
    > Ciao neil, thanks as usual for the reply.
    >
    > sorry for another question: what would be the best
    > DOM element to attach the panel to?
    >


    Not clear what you mean. The anchor can be any element. If you mean
    where should the panel be inserted, a suitable place is inside the XUL
    document root.

+ Reply to Thread