It was merely a stopgap solution to the problem of the dialog taking
forever to load. With that problem solved all of this awful code is no
longer needed.
The loading should be fast enough now after Id9397631 is merged,
taking no more than a second or two to render entirely. We could
consider showing a spinner while it's loading, but it doesn't seem
necessary.
This makes bug 39923 invalid.
Every time an item is added to the list - 387 times for me - we
shuffle elements around and add at least one new one. This causes
browsers to trigger style recalculation (to figure out which styles
apply to elements with such and such classes) and content reflows
(how the text and elements are wrapped to fit available width).
We can avoid this by simply detaching the parent element from the DOM
tree and attaching it back once we're done - this make it only trigger
one recalculation and one reflow.
In my profiling on Opera on a Thinkpad T60 (with lazy-loading
disabled), these two steps took respectively around 600ms and 400ms.
Now they're down to around 50ms each.