*
* @param {jQuery|string} changesListContent
* @param {jQuery} $fieldset
+ * @param {boolean} [isInitialDOM] Using the initial (already attached) DOM elements
*/
- mw.rcfilters.dm.ChangesListViewModel.prototype.update = function ( changesListContent, $fieldset ) {
+ mw.rcfilters.dm.ChangesListViewModel.prototype.update = function ( changesListContent, $fieldset, isInitialDOM ) {
this.valid = true;
- this.emit( 'update', changesListContent, $fieldset );
+ this.emit( 'update', changesListContent, $fieldset, isInitialDOM );
};
}( mediaWiki ) );
// so it gets processed
this.changesListModel.update(
$changesList.length ? $changesList : 'NO_RESULTS',
- $( 'fieldset.rcoptions' ).first()
+ $( 'fieldset.rcoptions' ).first(),
+ true // We're using existing DOM elements
);
}
* Respond to changes list model update
*
* @param {jQuery|string} $changesListContent The content of the updated changes list
+ * @param {jQuery} $fieldset The content of the updated fieldset
+ * @param {boolean} isInitialDOM Whether $changesListContent is the existing (already attached) DOM
*/
- mw.rcfilters.ui.ChangesListWrapperWidget.prototype.onModelUpdate = function ( $changesListContent ) {
+ mw.rcfilters.ui.ChangesListWrapperWidget.prototype.onModelUpdate = function ( $changesListContent, $fieldset, isInitialDOM ) {
var conflictItem,
$message = $( '<div>' )
.addClass( 'mw-rcfilters-ui-changesListWrapperWidget-results' ),
// Apply highlight
this.applyHighlight();
- // Make sure enhanced RC re-initializes correctly
- mw.hook( 'wikipage.content' ).fire( this.$element );
+ if ( !isInitialDOM ) {
+ // Make sure enhanced RC re-initializes correctly
+ mw.hook( 'wikipage.content' ).fire( this.$element );
+ }
}
this.popPending();
};
*
* @param {jQuery|string} $changesList Updated changes list
* @param {jQuery} $fieldset Updated fieldset
+ * @param {boolean} isInitialDOM Whether $changesListContent is the existing (already attached) DOM
*/
- mw.rcfilters.ui.FormWrapperWidget.prototype.onChangesModelUpdate = function ( $changesList, $fieldset ) {
+ mw.rcfilters.ui.FormWrapperWidget.prototype.onChangesModelUpdate = function ( $changesList, $fieldset, isInitialDOM ) {
this.$submitButton.prop( 'disabled', false );
// Replace the entire fieldset
this.$element.empty().append( $fieldset.contents() );
- // Make sure enhanced RC re-initializes correctly
- mw.hook( 'wikipage.content' ).fire( this.$element );
+
+ if ( !isInitialDOM ) {
+ // Make sure enhanced RC re-initializes correctly
+ mw.hook( 'wikipage.content' ).fire( this.$element );
+ }
this.cleanUpFieldset();