r57492 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57491‎ | r57492 | r57493 >
Date:21:36, 7 October 2009
Author:catrope
Status:ok (Comments)
Tags:
Comment:
NavigableTOC: (bug 21033) Fix Opera brokenness detection, was causing false positives on Safari 3.2 causing NTOC's cursor positioning to be off
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -64,7 +64,7 @@
6565 array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ),
6666 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 4 ),
6767 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 16 ),
68 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 11 ),
 68+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 12 ),
6969 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 12 ),
7070 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 4 ),
7171 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 18 ),
@@ -73,10 +73,10 @@
7474 array( 'src' => 'js/js2/jquery-ui-1.7.2.js', 'version' => '1.7.2y' ),
7575 ),
7676 'combined' => array(
77 - array( 'src' => 'js/plugins.combined.js', 'version' => 40 ),
 77+ array( 'src' => 'js/plugins.combined.js', 'version' => 41 ),
7878 ),
7979 'minified' => array(
80 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 40 ),
 80+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 41 ),
8181 ),
8282 ),
8383 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -123,10 +123,10 @@
124124 textarea.select();
125125 textarea.setSelection( index, index + 3 );
126126 textarea.encapsulateSelection( '', 'BAR', '', false, true );
127 - if ( textarea.val().substr( -1 ) == 'R' )
 127+ if ( textarea.val().substr( -4 ) != 'BARr' )
128128 $.isOperaBroken = false;
129129 else
130 - $.isOperaBroken = true;
 130+ $.isOperaBroken = true;
131131 div.remove();
132132 }
133133 if ( $.isOperaBroken )
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -1265,10 +1265,10 @@
12661266 textarea.select();
12671267 textarea.setSelection( index, index + 3 );
12681268 textarea.encapsulateSelection( '', 'BAR', '', false, true );
1269 - if ( textarea.val().substr( -1 ) == 'R' )
 1269+ if ( textarea.val().substr( -4 ) != 'BARr' )
12701270 $.isOperaBroken = false;
12711271 else
1272 - $.isOperaBroken = true;
 1272+ $.isOperaBroken = true;
12731273 div.remove();
12741274 }
12751275 if ( $.isOperaBroken )
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -81,7 +81,7 @@
8282 $(this).trigger('scrollToPosition');});}});})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3.1]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3.1]]}},imgPath:wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/'};$.wikiEditor.isSupportKnown=function(){return $.browser.name in $.wikiEditor.browsers[$('body.rtl').size()?'rtl':'ltr'];};$.wikiEditor.isSupported=function(){if(!$.wikiEditor.isSupportKnown){return true;}
8383 var browser=$.wikiEditor.browsers[$('body.rtl').size()?'rtl':'ltr'][$.browser.name];for(condition in browser){var op=browser[condition][0];var val=browser[condition][1];if(typeof val=='string'){if(!(eval('$.browser.version'+op+'"'+val+'"'))){return false;}}else if(typeof val=='number'){if(!(eval('$.browser.versionNumber'+op+val))){return false;}}}
8484 return true;};$.wikiEditor.autoMsg=function(object,property){if(typeof property=='object'){for(i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}}
85 -if(property in object){return object[property];}else if(property+'Msg'in object){return gM(object[property+'Msg']);}else{return'';}};$.wikiEditor.fixOperaBrokenness=function(s){if(typeof $.isOperaBroken=='undefined'&&$.wikiEditor.instances.length>0){var div=$('<div />').height(0).width(0).insertBefore($.wikiEditor.instances[0]);var textarea=$('<textarea />').height(0).appendTo(div).val("foo\r\nbar");var index=textarea.val().indexOf('bar');textarea.select();textarea.setSelection(index,index+3);textarea.encapsulateSelection('','BAR','',false,true);if(textarea.val().substr(-1)=='R')
 85+if(property in object){return object[property];}else if(property+'Msg'in object){return gM(object[property+'Msg']);}else{return'';}};$.wikiEditor.fixOperaBrokenness=function(s){if(typeof $.isOperaBroken=='undefined'&&$.wikiEditor.instances.length>0){var div=$('<div />').height(0).width(0).insertBefore($.wikiEditor.instances[0]);var textarea=$('<textarea />').height(0).appendTo(div).val("foo\r\nbar");var index=textarea.val().indexOf('bar');textarea.select();textarea.setSelection(index,index+3);textarea.encapsulateSelection('','BAR','',false,true);if(textarea.val().substr(-4)!='BARr')
8686 $.isOperaBroken=false;else
8787 $.isOperaBroken=true;div.remove();}
8888 if($.isOperaBroken)

Follow-up revisions

RevisionCommit summaryAuthorDate
r57719wmf-deployment: Merge babaco fixes from trunk...catrope20:20, 14 October 2009

Comments

#Comment by Platonides (talk | contribs)   23:05, 7 October 2009

I don't think Opera brokenness comes from trying to emulate both Geck and IE. It looks like they wanted to use \n in the value but used native windows controls for operation selection. Perhaps they kept it on purpose, to keep backwards compatibility, though.

#Comment by Catrope (talk | contribs)   10:08, 8 October 2009

No, I don't seriously think that either, I was just ranting :) major design flaws like these leading to bugs in our code kinda pissed me off.

Status & tagging log