lichobile
lichobile copied to clipboard
Fix mithril DOMException when reordering gamecards
fixes dom exception when mithril tries to reorder the game cards after they are wrapped by Siema's slider frames
steps to reproduce (landscape orientation only, there may be other ways):
- start two correspondence games where it is the opponent to move
- click the ongoing games button top-right and find the game second in list
- close the overlay again and make a move for the opponent in the second game
- open ongoing games again, and a DOMException will appear
DOMException: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node
mithril tries to move the second game to the front after the session is refreshed, but can't because the game cards have been wrapped in slider divs by siema
this is fixed by creating the wrapper divs from mithril, and only let siema do the styling there may be other (better?) ways, but this seemed least intrusive to me