r96622 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96621‎ | r96622 | r96623 >
Date:22:26, 8 September 2011
Author:brion
Status:ok
Tags:
Comment:
MFT r94702: fix for a jquery.highlightText regression in r90092
Modified paths:
  • /branches/REL1_18/phase3/resources/jquery/jquery.highlightText.js (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/resources/jquery/jquery.highlightText.js
@@ -24,8 +24,9 @@
2525 // non latin characters can make regex think a new word has begun: do not use \b
2626 // http://stackoverflow.com/questions/3787072/regex-wordwrap-with-utf8-characters-in-js
2727 // look for an occurence of our pattern and store the starting position
28 - var pos = node.data.search( new RegExp( "(^|\\s)" + $.escapeRE( pat ), "i" ) );
29 - if ( pos >= 0 ) {
 28+ var match = node.data.match( new RegExp( "(^|\\s)" + $.escapeRE( pat ), "i" ) );
 29+ if ( match ) {
 30+ var pos = match.index + match[1].length; // include length of any matched spaces
3031 // create the span wrapper for the matched text
3132 var spannode = document.createElement( 'span' );
3233 spannode.className = 'highlight';

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r90092fix for bug29371 . regex wordwrap with UTF8: do not use \b metacharacter. The...wikinaut21:42, 14 June 2011
r94702Fix a regression in search highlighting from r90092...brion22:42, 16 August 2011

Status & tagging log