Fix JS errors thrown by SimpleSearch: add dependency from jquery.autoEllipsis to...
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 23 Dec 2010 14:16:20 +0000 (14:16 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 23 Dec 2010 14:16:20 +0000 (14:16 +0000)
resources/Resources.php
resources/jquery/jquery.highlightText.js

index 6f5c2f1..6c205ab 100644 (file)
@@ -45,7 +45,8 @@ return array(
                'scripts' => 'resources/jquery/jquery.async.js'
        ),
        'jquery.autoEllipsis' => array(
-               'scripts' => 'resources/jquery/jquery.autoEllipsis.js'
+               'scripts' => 'resources/jquery/jquery.autoEllipsis.js',
+               'dependencies' => 'jquery.highlightText',
        ),
        'jquery.checkboxShiftClick' => array(
                'scripts' => 'resources/jquery/jquery.checkboxShiftClick.js'
index 19a0deb..7ca29ef 100644 (file)
@@ -23,7 +23,7 @@ $.highlightText = {
                        // TODO - need to be smarter about the character matching here. 
                        // non latin characters can make regex think a new word has begun. 
                        // look for an occurence of our pattern and store the starting position 
-                       var pos = node.data.search( new RegExp( "\\b" + RegExp.escape( pat ), "i" ) );
+                       var pos = node.data.search( new RegExp( "\\b" + $.escapeRE( pat ), "i" ) );
                        if ( pos >= 0 ) {
                                // create the span wrapper for the matched text
                                var spannode = document.createElement( 'span' );