diff options
author | Func <Funcer@outlook.com> | 2022-01-07 15:07:08 +0000 |
---|---|---|
committer | DannyS712 <dannys712.wiki@gmail.com> | 2022-01-10 00:33:56 +0000 |
commit | fab9b871a1aad3b8720cfc0beb7ad6cb88133c20 (patch) | |
tree | fee2f6740ddb3fbfcab3601d9cdadc99a1d274fb | |
parent | 804dcac8a393adcaacf9371074cce32cae81971c (diff) |
multiselect: Replace overqualified jQuery selector
HTMLMultiSelectField can be extended, and mw-htmlform-field-* would be changed accordingly.
Only in OOUI mode can have multiple elements with mw-htmlform-dropdown class, so it's fine to use `:not(.oo-ui-widget)`.
Change-Id: I921eefb1eb3b4b48613a657645f58f7a87c9504c
-rw-r--r-- | resources/src/mediawiki.htmlform/multiselect.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/resources/src/mediawiki.htmlform/multiselect.js b/resources/src/mediawiki.htmlform/multiselect.js index 06343bf6c3f5..b77f254fa255 100644 --- a/resources/src/mediawiki.htmlform/multiselect.js +++ b/resources/src/mediawiki.htmlform/multiselect.js @@ -6,7 +6,7 @@ function addMulti( $oldContainer, $container ) { var name = $oldContainer.find( 'input:first-child' ).attr( 'name' ), - oldClass = ( ' ' + $oldContainer.attr( 'class' ) + ' ' ).replace( /(mw-htmlform-field-HTMLMultiSelectField|mw-htmlform-dropdown)/g, '' ), + oldClass = ( ' ' + $oldContainer.attr( 'class' ) + ' ' ).replace( /(mw-htmlform-field-[A-Za-z]+|mw-htmlform-dropdown)/g, '' ), $select = $( '<select>' ), dataPlaceholder = mw.message( 'htmlform-chosen-placeholder' ); oldClass = oldClass.trim(); @@ -92,7 +92,7 @@ } mw.hook( 'htmlform.enhance' ).add( function ( $root ) { - var $dropdowns = $root.find( '.mw-htmlform-field-HTMLMultiSelectField.mw-htmlform-dropdown' ); + var $dropdowns = $root.find( '.mw-htmlform-dropdown:not(.oo-ui-widget)' ); if ( $dropdowns.length ) { $dropdowns.each( function () { var $el = $( this ), |