http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96622

Revision: 96622
Author:   brion
Date:     2011-09-08 22:26:12 +0000 (Thu, 08 Sep 2011)
Log Message:
-----------
MFT r94702: fix for a jquery.highlightText regression in r90092

Modified Paths:
--------------
    branches/REL1_18/phase3/resources/jquery/jquery.highlightText.js

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


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to