On Wed, May 7, 2008 at 12:17 PM, Erik Arvidsson <[EMAIL PROTECTED]> wrote: > The quote method needs more specification. It needs to escape a lot > more characters than just single and double quotes. The basic rule is > that String.prototype.quote should return a string that would be a > valid string literal for that string. > > For example: > > "a\nb".quote() => "\"a\\nb\""
I would expect that "a\nb".quote() would produce "a\nb" (a string with 6 characters) and that's what Firefox implements, along with a toplevel uneval that works on strings, arrays, objects, etc.. I think it would be very confusing for us to convert single newline characters to an escaped backslash and 'n'! Having a way to escape metacharacters could be valuable, but I think much more valuable for the set of metacharacters that are meaningful to regular expressions. I think that's provided by more toolkits than .quoteQuotes, and is harder to get right. Mike _______________________________________________ Es4-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es4-discuss
