orokusaki
orokusaki

Reputation: 57198

Why does jQuery 1.4.2 compressed have a syntax error?

I always have noticed this, including in versions before as well. About half way through jQuery's compressed version you'll see some regex:

[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^

The error appears to be at ['"]

I'm sure it's not really a syntax error, but all my code editors recognize it as one, which makes development a pain if I try to combine JavaScript files. Does anyone know what's going on here?

Upvotes: 3

Views: 174

Answers (2)

mkoryak
mkoryak

Reputation: 57998

your code editor sucks, this isnt a syntax error if its inside of a regex literal, which i suspect it is.

the code editor you use probably doesnt support regex literals properly, and that its a string , which would cause the error

Upvotes: 2

recursive
recursive

Reputation: 86174

It's a character entity in a regular expression, as specified by the square brackets. There are no restrictions on quote characters in them. All that's going on is buggy syntax highlighting. Ask the developer of your editor.

Upvotes: 4

Related Questions