htmlform multiselect chosen: Replace lists
authorRyan Lane <rlane@wikimedia.org>
Thu, 8 Aug 2013 08:22:42 +0000 (16:22 +0800)
committerRyan Lane <rlane@wikimedia.org>
Thu, 22 Aug 2013 17:47:23 +0000 (10:47 -0700)
Rather than appending a new checkbox list and removing the old one,
replace the old list with the new one, to preserve ordering.

Change-Id: Idd77455bdbaf423e7a51cf3789460d1980f78922

resources/mediawiki/mediawiki.htmlform.js

index 8e764e1..de06859 100644 (file)
                $fieldLabelText.text( $oldContainer.find( '.mw-label label' ).text() );
                $fieldLabel.append( $fieldLabelText );
                $container.prepend( $fieldLabel );
-               $oldContainer.parent().append( $container );
-               $oldContainer.remove();
+               $oldContainer.replaceWith( $container );
                return $container;
        }