Secondly a strange observation. The problem was not apparent after opening a window and using document.write() to write the source to it, nor did it appear if the source was supplied using "javascript://" as the scheme. (I use a text area with buttons for quick testing) The problem only appeared after saving the source to disk and opening as file. I have no idea why.
You cannot have multiple ID's with the same name... browsers will always only pick the first one they discover. ID's should always be unique per page.
Anyway, the root of the problem is likely using that inline anonymous code like that. It probably executes before the page is finished rendering, causing weird problems. You really should wrap that call in a function and then activate the function with an observer such as onload.
I tested placing the body script element code into a "load" event listener before posting. This did not affect the lingering outline produced in Firefox. I totally agree attempts to modify the DOM before the load event fires can lead to failure and are to be avoided, but ruled it out as the cause in this case. I'd support calling this a bug with reproducibility affected by the scheme used.
mozillaZine is an independent Mozilla community and advocacy site. We're not affiliated or endorsed by the Mozilla Corporation but we love them just the same.