From 85d474d85f4ad90aa50a28e6610bc34cf9448279 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Thu, 23 Dec 2010 14:16:20 +0000 Subject: [PATCH] Fix JS errors thrown by SimpleSearch: add dependency from jquery.autoEllipsis to jquery.highlightText, and fix the latter for the RegExp.escape() -> $.escapeRE() rename --- resources/Resources.php | 3 ++- resources/jquery/jquery.highlightText.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/Resources.php b/resources/Resources.php index 6f5c2f1c0d..6c205ab342 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -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' diff --git a/resources/jquery/jquery.highlightText.js b/resources/jquery/jquery.highlightText.js index 19a0deb288..7ca29efde2 100644 --- a/resources/jquery/jquery.highlightText.js +++ b/resources/jquery/jquery.highlightText.js @@ -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' ); -- 2.20.1