r101574 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101573‎ | r101574 | r101575 >
Date:02:13, 2 November 2011
Author:inez
Status:deferred
Tags:
Comment:
Minor fix and use RegExp (faster) instead of jQuery.inArray(...)
Modified paths:
  • /trunk/parsers/wikidom/lib/hype/views/es.SurfaceView.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/hype/views/es.SurfaceView.js
@@ -78,7 +78,7 @@
7979 this.documentView.renderContent();
8080 };
8181
82 -es.SurfaceView.boundaries = [' ', '-', '\t', '\r', '\n', '\f'];
 82+es.SurfaceView.boundaryTest = /([ \-\t\r\n\f])/;
8383
8484 es.SurfaceView.prototype.onMouseDown = function( e ) {
8585 var offset = this.documentView.getOffsetFromEvent( e );
@@ -156,7 +156,7 @@
157157 var end = this.documentView.getRenderedLineRange( this.cursor.offset ).end
158158 var data = this.documentView.getModel().data;
159159 if ( es.DocumentModel.isContentData( data, end ) ) {
160 - while( $.inArray( data[ end - 1 ], es.SurfaceView.boundaries ) ) {
 160+ while( es.SurfaceView.boundaryTest.exec( data[ end - 1 ] ) ) {
161161 end--;
162162 }
163163 }

Status & tagging log