That said, if what you're doing involves updateKeyHighlight being called
on every mousemove, then there are a several of things that it's doing
suboptimally:
1) It's serializing and parsing some HTML on every mousemove.
2) It's probably doing at two relayouts on every mousemove (because it
changes content, then gets layout information, then changes styles).
It seems like the right approach here is to store what the last target
was for which we showed the highlight, and if that target hasn't changed
bail out early from updateKeyHighlight. And then move the innerHTML set
and className set down to where the style sets happen. And perhaps
double-check whether you really need innerHTML there or whether
something like textContent will actually do what you want? If you do
those, how do things look?
-Boris