GroupElement: Improve performance by avoiding .add() overhead

addItems() calls jQuery's .add(), which deduplicates the added
elements with the elements already in the collection. This is
the equivalent of a nested for loop: it runs in O(n^2) time and
the comparsions are expensive.

We could maintain $items as a plain array instead, but we don't really
need it, so just remove it (and fix the one place where it was used).

The other usage of .add() is to gather the elements to add into a
temporary jQuery collection, so do that in an array instead.

This make the addItems() call in the LanguageResultWidget constructor
(~300 items) go from ~12 seconds to ~25ms.

Bonus: make insertion at an offset in the middle saner, it only
worked because .add() sorts elements, which is a horrible thing
to rely on.

Bug: 65512
Change-Id: Icaa4aa99e33b7a42fe530aeb25964e33af4d51ae
Merge "GroupElement: Improve performance by avoiding .add() overhead"