[Webkit-unassigned] [Bug 50554] RegExp.prototype.toString does not escape slashes

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 14 12:29:08 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=50554





--- Comment #3 from Mark Hahnenberg <mhahnenb at gmail.com>  2011-01-14 12:29:08 PST ---
(In reply to comment #2)

> Sorry - I don't follow, what's your reasoning here? - based on the interpretation above, FF's pattern does represent the source, and "abc\/def" is a valid pattern per section 15.10.1 of the spec ("\/" is a valid IdentityEscape).  Are you assuming a more strict definition of 'source'? - that it must match the pattern compiled from?

I misread the grammar for Patterns.  You are correct.

> pros to switching:
> * it's good from a web compatibility perspective to match FireFox.
> * from a developer's perspective, the escaped form is more useful (can be concatenated into a string & eval'ed as a valid RegularExpressionLiteral).
> * from a developer's perspective, I'd argue having two string representations for a RegExp would be potentially confusing & could be problematic, likely better to have a single canonical string representation associated with a given RegExp.
> 
> cons to switching:
> * intuitively it seems like 'source' should actually be the source the expression was compiled from.
> 
> On balance, I'd certainly favour following FF on this one.

I agree with this :-)  I'll make the necessary changes to make source and toString() match Firefox's behavior (interestingly, RegExp objects created using the literal notation already match Firefox's behavior).

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list