How to avoid custom elements reconstructed when containing array is sorted

I created a an example gist here:

My example has a list of cards representing a persons name and age. The cards can be sorted by age or name. Each card also has the most amazing feature that allows you to optionally make the card red. This state is stored on the card in the “styleString” property.

If you make each card red and then do a sort, you will notice some cards will become white. I think this happens when a card needs to be moved up in the array. In these cases it appears that the card custom element is removed and it is replaced with a new custom element, thus the “styleString” state is lost on the card.

I don’t really care if the item is temporarily removed and added from the DOM (I think that is probably necessary), but I’d like to keep an instance of the same object, rather than get a new element when doing sorting like this. Is that possible?