r105705 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105704‎ | r105705 | r105706 >
Date:20:29, 9 December 2011
Author:inez
Status:deferred
Tags:
Comment:
Fix onMouseDown event handler for IE8 (still double and triple click does not work)
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
@@ -157,6 +157,7 @@
158158
159159 // Configuration
160160 this.mac = navigator.userAgent.match(/mac/i) ? true : false; // (yes it's evil, for keys only!)
 161+ this.ie8 = $.browser.msie && $.browser.version === "8.0";
161162
162163 // Initialization
163164 this.$input.focus();
@@ -325,7 +326,7 @@
326327 var selection = this.currentSelection.clone(),
327328 offset = this.documentView.getOffsetFromEvent( e );
328329 // Single click
329 - if ( e.originalEvent.detail === 1 ) {
 330+ if ( this.ie8 || e.originalEvent.detail === 1 ) {
330331 // @see {es.SurfaceView.prototype.onMouseMove}
331332 this.mouse.selectingMode = 1;
332333
@@ -365,15 +366,30 @@
366367 );
367368 this.mouse.selectedRange = selection.clone();
368369 }
369 - // Reset the initial left position
370 - this.cursor.initialLeft = null;
371 - // Apply new selection
372 - this.model.select( selection, true );
373370 }
374 - // If the inut isn't already focused, focus it and select it's contents
375 - if ( !this.$input.is( ':focus' ) ) {
376 - this.$input.focus().select();
 371+
 372+ var _this = this;
 373+
 374+ function select() {
 375+ if ( e.which === 1 ) {
 376+ // Reset the initial left position
 377+ _this.cursor.initialLeft = null;
 378+ // Apply new selection
 379+ _this.model.select( selection, true );
 380+ }
 381+
 382+ // If the inut isn't already focused, focus it and select it's contents
 383+ if ( !_this.$input.is( ':focus' ) ) {
 384+ _this.$input.focus().select();
 385+ }
377386 }
 387+
 388+ if ( this.ie8 ) {
 389+ setTimeout( select, 0 );
 390+ } else {
 391+ select();
 392+ }
 393+
378394 return false;
379395 };
380396

Status & tagging log