Firefox marquee restarts prematurely

I was trying to fix a HTML marquee bug today, where only on Firefox the marquee restarts itself before the whole message scrolls to the end. After stripping down the page the cause appears to be Firefox observing the length of the original text (which was just a single space character).

The HTML code below reproduces it. Click on “Change Marquee Text” to see the difference between the two marquees.

At first

Later, the marquee text became longer but Firefox does not recognize it.

Not worth to further investigate here, I just dynamically re-rendered a container div for this marquee.