BE WARNED WHEN DEBUGGING JAVASCRIPT IN CHROME!
It seems Chrome reports the wrong line (also when viewing the source
the error message is in the middle of a totally different line) when
you have a JS file with a lot of long lines of code.
After searching the code for the word 'native' it seems it was used in
the jQMinMax plugin, and it's a reserved keyword in Chrome (when I
include this JS file separately it reports the right error line).

There's a full list of (possibly) reserved keywords available here:
http://www.quackit.com/javascript/javascript_reserved_words.cfm, some
are not reserved in current implementations, but it might be a good
idea to avoid these words since any new browser can start using them
and break existing scripts.
It might also be a good idea to include a list of these variable names
that cannot be used in jQuery plugins in the documentation at:
http://docs.jquery.com/Tutorials#Plugin_Development

Regards,
THD


On Apr 6, 12:45 pm, THD <[email protected]> wrote:
> I've been breaking my head on this problem for a while, but I can't
> find the cause of this error in GoogleChrome. So now I turn to the
> jQuery dev list in the hope that someone here has encountered this
> problem too (and perhaps knows a solution).
>
> The full error I get fromChromeis: 'Uncaught SyntaxError: Unexpected
> token native'.
>
> The error was in some jQuery plugin, but it seems to be on the line
> with a fixed amount of bytes/words from the start of the file. The
> code at the error is valid, and when code is added or removed the
> error moves to another line so there appears to be no relation to the
> actual code there.
> The file is a concatenation of a series of JS files (including jQuery
> and UI with a lot of plugins). The file is about 100K gzipped, and 400-
> something uncompressed so it's fairly large and I suspectChrome
> doesn't handle this very well...
>
> Things i've tried so far:
> - Load the part of code with the error on separate page inChrome
> (there is no error)
> - Look for UTF BOM in one of the JS files (none found)
> - Look for special characters or possible reserved words (token
> native?) in the code (none found)
> - Test browsers IE6/7/8/Firefox Win/Firefox Linux/Safari/Opera (no
> error)
> - Test inChrome1.0.154.53 (current) - ERROR
> - Test inChrome2.0.169.1 (beta) - ERROR
> - Syntax checking the file with JSlint is no option since it borks on
> the first jQuery line. ;)
>
> Does anyone know what this problem withChromemight be?
> When it is just the filesize there should be at least another person
> here with a jQuery + UI + plugins file who encountered this...
> When other people can recreate this problem withChromewe might also
> have to file a bug report.
>
> TIA!
>
> Regards,
> THD
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" 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/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to