r91343 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91342‎ | r91343 | r91344 >
Date:08:54, 2 July 2011
Author:hartman
Status:ok
Tags:
Comment:
Clean up some global var leaking in WikiEditor toolbar

Reported in bug 29106. Patch by Michael M.
Modified paths:
  • /trunk/extensions/WikiEditor/modules/ext.wikiEditor.tests.toolbar.js (modified) (history)
  • /trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiEditor/modules/ext.wikiEditor.tests.toolbar.js
@@ -213,7 +213,7 @@
214214 var $ui = $target.data( 'wikiEditor-context' ).$ui;
215215 var passes = 0;
216216 var tests = 0;
217 - for ( test in wikiEditorTests ) {
 217+ for ( var test in wikiEditorTests ) {
218218 var pre = $ui.find( wikiEditorTests[test].test ).size() ==
219219 wikiEditorTests[test].pre;
220220 messages.push ( test + '-pre: ' + ( pre ? 'PASS' : 'FAIL' ) );
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js
@@ -103,7 +103,7 @@
104104 if ( ! ( 'section' in data && 'page' in data ) ) {
105105 continue;
106106 }
107 - $characters = context.modules.toolbar.$toolbar.find(
 107+ var $characters = context.modules.toolbar.$toolbar.find(
108108 'div[rel=' + data.section + '].section ' + 'div[rel=' + data.page + '].page div'
109109 );
110110 var actions = $characters.data( 'actions' );
@@ -135,7 +135,7 @@
136136 // Fix div.section size after adding things; if smooth is true uses a smooth
137137 // animation, otherwise just change height (breaking any ongoing animation)
138138 var $divSections = context.modules.toolbar.$toolbar.find( 'div.sections' );
139 - $visibleSection = $divSections.find( '.section:visible' );
 139+ var $visibleSection = $divSections.find( '.section:visible' );
140140 if ( $visibleSection.size() ) {
141141 if ( smooth ) {
142142 $divSections.animate( { 'height': $visibleSection.outerHeight() }, 'fast' );
@@ -491,7 +491,7 @@
492492 break;
493493 case 'characters':
494494 $page.addClass( 'page-characters' );
495 - $characters = $( '<div/>' ).data( 'context', context ).data( 'actions', {} );
 495+ var $characters = $( '<div/>' ).data( 'context', context ).data( 'actions', {} );
496496 var actions = $characters.data( 'actions' );
497497 if ( 'language' in page ) {
498498 $characters.attr( 'lang', page.language );
@@ -598,7 +598,7 @@
599599 var $section =
600600 $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) );
601601 var show = $section.css( 'display' ) == 'none';
602 - $previousSections = $section.parent().find( '.section-visible' );
 602+ var $previousSections = $section.parent().find( '.section-visible' );
603603 $previousSections.css( 'position', 'absolute' );
604604 $previousSections.removeClass( 'section-visible' );
605605 $previousSections.fadeOut( 'fast', function() { $(this).css( 'position', 'relative' ); } );

Follow-up revisions

RevisionCommit summaryAuthorDate
r91347Correct for in loops on arrays....hartman09:09, 2 July 2011
r91349Adding quotes for the [rel=] stuff, since this broke one test....hartman09:17, 2 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r89616Extension:WikiEditor Code quality, JSHint validation and JSPERF...krinkle23:18, 6 June 2011
r90845Bug #29106: Patch from Michael M. to address JS legacy globals in wikiEditormah19:25, 26 June 2011
r91342* Fix broken post call to api in side-to-side diffs...hartman08:46, 2 July 2011

Status & tagging log