http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95079

Revision: 95079
Author:   catrope
Date:     2011-08-20 12:47:00 +0000 (Sat, 20 Aug 2011)
Log Message:
-----------
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: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js
===================================================================
--- trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js    
2011-08-20 11:17:18 UTC (rev 95078)
+++ trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js    
2011-08-20 12:47:00 UTC (rev 95079)
@@ -86,10 +86,12 @@
                        }
                        // If the dialog already exists, but for another 
textarea, simply remove it
                        var $existingDialog = $( '#' + module.id );
-                       if ( $existingDialog.size() > 0 && 
$existingDialog.data( 'context' ).$textarea != context.$textarea ) {
+                       if ( $existingDialog.length > 0 && 
$existingDialog.data( 'context' ).$textarea != context.$textarea ) {
                                $existingDialog.remove();
                        }
-                       if ( !filtered && $.wikiEditor.isSupported( module ) && 
$existingDialog.size() == 0 ) {
+                       // Re-select from the DOM, we might have removed the 
dialog just now
+                       $existingDialog = $( '#' + module.id );
+                       if ( !filtered && $.wikiEditor.isSupported( module ) && 
$existingDialog.size() === 0 ) {
                                $.wikiEditor.modules.dialogs.modules[mod] = 
module;
                                // If this dialog requires the iframe, set it up
                                if ( typeof context.$iframe == 'undefined' && 
$.wikiEditor.isRequired( module, 'iframe' ) ) {


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to