Sunday, April 18, 2010

Hiding XUL elements on OSX on Firefox 3.5.8

I was recently confused as to why the following code would not work in a XUL overlay:

var foo = document.getElementById("foo");
foo.style.display = "none";


In this case, the element foo was a XUL element; not HTML. Further investigation found that the above code worked on Windows and Linux builds of Firefox, but not OSX; only the following appeased the Firefox gods:

var foo = document.getElementById("foo");
foo.hidden = true;


This does what you want on all platforms; not especially obvious from the austere MDC article!