Merge "Deprecate assertException in MediaWikiTestCase as it adds no value"
[lhc/web/wiklou.git] / resources / mediawiki / mediawiki.htmlform.js
index 77ceee4..de06859 100644 (file)
@@ -90,7 +90,7 @@
                $td = $( '<td>' ),
                $fieldLabelText = $( '<label>' ),
                $container;
-               if ( type === 'table' ) {
+               if ( type === 'tr' ) {
                        addMulti( $oldContainer, $td );
                        $container = $( '<tr>' );
                        $container.append( $td );
                $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;
        }
 
        if ( $( '.mw-chosen' ).length ) {
                mw.loader.using( 'jquery.chosen', function () {
-                       var $toConvert,
-                       $converted;
-                       $toConvert = $( 'table .mw-chosen' );
-                       if ( $toConvert.length ) {
-                               $converted = convertCheckboxesToMulti( $toConvert, 'table' );
+                       $( '.mw-chosen' ).each( function () {
+                               var type = this.nodeName.toLowerCase(),
+                                       $converted = convertCheckboxesToMulti( $( this ), type );
                                $converted.find( '.htmlform-chzn-select' ).chosen( { width: 'auto' } );
-                       }
-                       $toConvert = $( 'div .mw-chosen' );
-                       if ( $toConvert.length ) {
-                               $converted = convertCheckboxesToMulti( $toConvert, 'div' );
-                               $converted.find( '.htmlform-chzn-select' ).chosen( { width: 'auto' } );
-                       }
+                       } );
                } );
        }