[Project_owners] Sidebar onclose/unload

Philip Chee philip at aleytys.pc.my
Sun Dec 17 17:52:03 PST 2006

On Sun, 17 Dec 2006 22:51:23 +0100, Brian King wrote:

> [Firefox Sidebar]

> I can find out when my content is loading using:

> document.getElementById("sidebar").addEventListener("DOMContentLoaded", 
> myFunction, false);

> However, onclose and onunload on the content loaded in does not work. Is 
> there is a way to find out when the sidebar is closing? Preferably the 
> solution determines all cases (x button being clicked, some other 
> content taking the place of your content, Firefox closing).

Listen for a mutation event on the sidebar element - something like
DOMAttrModified and check for changes in the "hidden" property in your
listener code.

Don't hook into toggleSidebar() unless absolutely necessary. I had to
solve conficts where two extensions both tried to grab toggleSidebar and
replace it with mutually incompatible code resulting in unpleasant side

Philip Chee <philip at aleytys.pc.my>, <philip.chee at gmail.com>
http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.
[ ]The world is coming to an end.  Please log off.
* TagZilla 0.059.4

More information about the Project_owners mailing list