in reply to Re: Re: Re: strip JS-comments
in thread strip JS-comments

No. It isn't. But your " // text " is not a // but a string. So my script doesn't even notice there is a // inside the string.

On the other hand; My script will fail given something like

var.match(//);
(is this legal JavaScript code?)

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: strip JS-comments
by Jenda (Abbot) on Jun 10, 2003 at 15:14 UTC

    No it's not legal according to M$IE 6.0 and 5.5. It returns a "Syntax error". So it seems empty regexes are not allowed and you are safe.

    Jenda
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
       -- Rick Osborne

    Edit by castaway: Closed small tag in signature