I agree (at least on the style, I'm sure it's faster though). The
original code looks like a newbie hack or sorts.
On 6/23/07, Miha Zimin <[EMAIL PROTECTED]> wrote:
>
> Lets see the original prototype.js v.1.5.1.1 strip method of String
> class:
>
> strip: function() {
> return this.replace(/^\s+/, '').replace(/\s+$/, '');
> }
>
> In my tests in various browsers this version of strip method:
>
> strip: function(str) {
> return this.replace(/^\s*(.*?)\s*$/, '$1');
> }
>
> return it value slightly faster.
> And I think it's more "good style".
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---