MediaSearchWidget: Listen to "change" event to reposition
authorMoriel Schottlender <moriel@gmail.com>
Wed, 5 Apr 2017 21:55:15 +0000 (14:55 -0700)
committerBartosz Dziewoński <matma.rex@gmail.com>
Mon, 10 Apr 2017 18:50:45 +0000 (18:50 +0000)
commit1e9341d506a1ab1ac01de3a63017a884200c0bf6
tree00f68b624de44baa128c5b0e50c47b61ef6d510c
parent3d831abcb7a29513ba170095b4afc35112d64829
MediaSearchWidget: Listen to "change" event to reposition

The "add" event is emitted too early (by the OO.EmitterList, before
the items are attached to the DOM) so instead we have to go by the
GroupElement event api itself -- which uses "change" event to all
item changes.

Listening to item change means that we are certain the items are
already attached to the DOM before we manipulate and read their
positioning, etc.

Bug: T162202
Change-Id: I3ef9d9451562c725e12a66b80048fc3836280d9f
resources/src/mediawiki.widgets/MediaSearch/mw.widgets.MediaSearchWidget.js