On 11/08/2009 03:41 PM, Martijn Pieters wrote:
>
> Thanks again for debugging this!
>
You're welcome!
I gave a look at the code, and it's indeed much cleaner than my solution.
I was however thinking if it wasn't better, in the "lstrip" [1]
equivalent to use + instead of *.
Right now, it does not make any difference (if there is no & at the
beginning, inserts an empty string at the beginning of the line anyway,
which amounts to not changing it) but I think it's more straightforward
to specify that there is to be atleast one & to perform the replace.
I've attached the diff (okay, the change amounts to one character).
[1] I can't believe Javascript does not have such a basic function:
Mozilla has an incompatible function trim() that however does only trim
whitespace. Isn't there any tiny js library that has all this sort of
utility functions? Without having to pull in an entire framework, I
mean. Reimplementing the wheel each time is tedious.
--
Simone Deponti
Index: plone/app/javascript/browser/jquery.highlightsearchterms.js
===================================================================
--- plone/app/javascript/browser/jquery.highlightsearchterms.js (revision 31206)
+++ plone/app/javascript/browser/jquery.highlightsearchterms.js (working copy)
@@ -51,7 +51,7 @@
if (uri.indexOf('?') < 0) return '';
uri = uri.substr(uri.indexOf('?') + 1);
while (uri.indexOf('=') >= 0) {
- uri = uri.replace(/^\&*/, '');
+ uri = uri.replace(/^\&+/, '');
var pair = uri.split('&', 1)[0];
uri = uri.substr(pair.length);
var match = pair.match(regexp);
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.
http://p.sf.net/sfu/bobj-july_______________________________________________
Plone-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-developers