r95079 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95078‎ | r95079 | r95080 >
Date:12:47, 20 August 2011
Author:catrope
Status:ok
Tags:
Comment:
Followup r82900: per CR, use .length instead of size(), strict comparison with zero, and re-select from the DOM after removal to guard against weird interaction between .remove() and .length
Modified paths:
  • /trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js
@@ -86,10 +86,12 @@
8787 }
8888 // If the dialog already exists, but for another textarea, simply remove it
8989 var $existingDialog = $( '#' + module.id );
90 - if ( $existingDialog.size() > 0 && $existingDialog.data( 'context' ).$textarea != context.$textarea ) {
 90+ if ( $existingDialog.length > 0 && $existingDialog.data( 'context' ).$textarea != context.$textarea ) {
9191 $existingDialog.remove();
9292 }
93 - if ( !filtered && $.wikiEditor.isSupported( module ) && $existingDialog.size() == 0 ) {
 93+ // Re-select from the DOM, we might have removed the dialog just now
 94+ $existingDialog = $( '#' + module.id );
 95+ if ( !filtered && $.wikiEditor.isSupported( module ) && $existingDialog.size() === 0 ) {
9496 $.wikiEditor.modules.dialogs.modules[mod] = module;
9597 // If this dialog requires the iframe, set it up
9698 if ( typeof context.$iframe == 'undefined' && $.wikiEditor.isRequired( module, 'iframe' ) ) {

Sign-offs

UserFlagDate
Nikerabbitinspected13:58, 20 August 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r95628MFT to REL1_18 (extensions)...hashar15:32, 28 August 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82900Fixes bug when having multiple textareas, which is caused by the fact that di...janpaul12317:14, 27 February 2011

Status & tagging log