r91349 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91348‎ | r91349 | r91350 >
Date:09:17, 2 July 2011
Author:hartman
Status:ok (Comments)
Tags:
Comment:
Adding quotes for the [rel=] stuff, since this broke one test.

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

Diff [purge]

Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.toolbar.js
@@ -40,7 +40,7 @@
4141 if ( ! ( 'section' in data ) ) {
4242 continue;
4343 }
44 - var $section = context.modules.toolbar.$toolbar.find( 'div[rel=' + data.section + '].section' );
 44+ var $section = context.modules.toolbar.$toolbar.find( 'div[rel="' + data.section + '"].section' );
4545 for ( var group in data[type] ) {
4646 // Group
4747 $section.append(
@@ -54,7 +54,7 @@
5555 continue;
5656 }
5757 var $group = context.modules.toolbar.$toolbar.find(
58 - 'div[rel=' + data.section + '].section ' + 'div[rel=' + data.group + '].group'
 58+ 'div[rel="' + data.section + '"].section ' + 'div[rel=' + data.group + '].group'
5959 );
6060 for ( var tool in data[type] ) {
6161 // Tool
@@ -70,10 +70,10 @@
7171 continue;
7272 }
7373 var $pages = context.modules.toolbar.$toolbar.find(
74 - 'div[rel=' + data.section + '].section .pages'
 74+ 'div[rel="' + data.section + '"].section .pages'
7575 );
7676 var $index = context.modules.toolbar.$toolbar.find(
77 - 'div[rel=' + data.section + '].section .index'
 77+ 'div[rel="' + data.section + '"].section .index'
7878 );
7979 for ( var page in data[type] ) {
8080 // Page
@@ -91,7 +91,7 @@
9292 continue;
9393 }
9494 var $table = context.modules.toolbar.$toolbar.find(
95 - 'div[rel=' + data.section + '].section ' + 'div[rel=' + data.page + '].page table'
 95+ 'div[rel="' + data.section + '"].section ' + 'div[rel=' + data.page + '].page table'
9696 );
9797 for ( i = 0; i < data.rows.length; i++ ) {
9898 // Row
@@ -104,7 +104,7 @@
105105 continue;
106106 }
107107 var $characters = context.modules.toolbar.$toolbar.find(
108 - 'div[rel=' + data.section + '].section ' + 'div[rel=' + data.page + '].page div'
 108+ 'div[rel="' + data.section + '"].section ' + 'div[rel="' + data.page + '"].page div'
109109 );
110110 var actions = $characters.data( 'actions' );
111111 for ( i = 0; data.character.length; i++ ) {
@@ -147,25 +147,25 @@
148148 removeFromToolbar : function( context, data ) {
149149 if ( typeof data.section == 'string' ) {
150150 // Section
151 - var tab = 'div.tabs span[rel=' + data.section + '].tab';
152 - var target = 'div[rel=' + data.section + '].section';
 151+ var tab = 'div.tabs span[rel="' + data.section + '"].tab';
 152+ var target = 'div[rel="' + data.section + '"].section';
153153 var group = null;
154154 if ( typeof data.group == 'string' ) {
155155 // Toolbar group
156 - target += ' div[rel=' + data.group + '].group';
 156+ target += ' div[rel="' + data.group + '"].group';
157157 if ( typeof data.tool == 'string' ) {
158158 // Save for later checking if empty
159159 group = target;
160160 // Tool
161 - target += ' span[rel=' + data.tool + '].tool';
 161+ target += ' span[rel="' + data.tool + '"].tool';
162162 }
163163 } else if ( typeof data.page == 'string' ) {
164164 // Booklet page
165 - var index = target + ' div.index div[rel=' + data.page + ']';
166 - target += ' div.pages div[rel=' + data.page + '].page';
 165+ var index = target + ' div.index div[rel="' + data.page + '"]';
 166+ target += ' div.pages div[rel="' + data.page + '"].page';
167167 if ( typeof data.character == 'string' ) {
168168 // Character
169 - target += ' span[rel=' + data.character + ']';
 169+ target += ' span[rel="' + data.character + '"]';
170170 } else if ( typeof data.row == 'number' ) {
171171 // Table row
172172 target += ' table tr:not(:has(th)):eq(' + data.row + ')';
@@ -719,14 +719,14 @@
720720 if ( selected != null ) {
721721 $.cookie( cookie, selected, { expires: 30, path: '/' } );
722722 }
723 - var $selectedIndex = $index.find( '*[rel=' + selected + ']' );
 723+ var $selectedIndex = $index.find( '*[rel="' + selected + '"]' );
724724 if ( $selectedIndex.size() === 0 ) {
725725 $selectedIndex = $index.children().eq( 0 );
726726 selected = $selectedIndex.attr( 'rel' );
727727 $.cookie( cookie, selected, { expires: 30, path: '/' } );
728728 }
729729 $pages.children().hide();
730 - $pages.find( '*[rel=' + selected + ']' ).show();
 730+ $pages.find( '*[rel="' + selected + '"]' ).show();
731731 $index.children().removeClass( 'current' );
732732 $selectedIndex.addClass( 'current' );
733733 },

Follow-up revisions

RevisionCommit summaryAuthorDate
r91385Follow up to r91349...hartman22:42, 3 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
r91343Clean up some global var leaking in WikiEditor toolbar...hartman08:54, 2 July 2011
r91347Correct for in loops on arrays....hartman09:09, 2 July 2011

Comments

#Comment by Krinkle (talk | contribs)   22:20, 3 July 2011

-						'div[rel=' + data.section + '].section ' + 'div[rel=' + data.group + '].group'
+						'div[rel="' + data.section + '"].section ' + 'div[rel=' + data.group + '].group'


-						'div[rel=' + data.section + '].section ' + 'div[rel=' + data.page + '].page table'
+						'div[rel="' + data.section + '"].section ' + 'div[rel=' + data.page + '].page table'

There's two of them on one line, may want to fix the other as well ;-)

Status & tagging log