PNS does not support JavaScript // comments

Hi,
I've got some JavaScript in my web pages, but notice that the web image compression utility removes end-of-lines from HTM and CGI files, presumably to save a bit of space.
Unfortunately, JavaScript // comments are terminated by end-of-line, so if you use them the rest of your web page gets commented out. To avoid this I recommend using C style comments instead, ie. /* comment */, or save space by not having comments!
Another downside of the compression removing eol's is that the browser sees one line of HTML and so if it needs to report an error (dunno about you, but I get this a lot!) you get "line 1, character n" which doesn't match up with your source code. This does make debugging a pain. Any chance you could make the compression less fearsome - after all it's not saving that much data.
Cheers
Simon
 

Technical

Technical Support
Staff member
We do not recommend using comments in the PNS web pages at all. Each character (comment or not) must be compressed, so you are simply wasting valuable EEPROM space.
 
I can't agree with that. I'm using 26% of the EEPROM space and the complexity is in the Javascript. Comments are really useful to get things working and why should I care if I use up a few bytes with comments and newlines while I'm getting the hard bit going - there's plenty of space. Once the debugging is done, I might wish to pack in lots of graphics, and at that point it makes sense to compress the HTML to jam as much in as possible. But your compression isn't that good - you leave all the redundant spaces and tabs that get used for layout behind, so by your argument you need to improve your code anyway. Obviously this is quick tricky to do, and I'd expect to have to do it by hand actually.
 
Top