Parsing Scripts - was Issue #65

Re: Parsing Scripts - was Issue #65

NoNoNo opened this Issue on 22 Aug 2012
 > I ran into a known bug, open for 5 years:
 > 
http://sourceforge.net/tracker/?func=detail&atid=390963&aid=1642186&group_id=27659
 >
 > Proposed patch:
 > 
http://sourceforge.net/tracker/?func=detail&atid=390965&aid=1644645&group_id=27659
 >
 > ```HTML
 > <!DOCTYPE html>
 > <html>
 > <head><title></title>
 > <body>
 > <script>
 > var a = '<script';
 > </script>
 > </body>
 > </html>
 > ```
 >
 > gives me:
 > ````
 > line 7 column 7 - Warning: '<' + '/' + letter not allowed here
 > line 8 column 5 - Warning: '<' + '/' + letter not allowed here
 > line 9 column 5 - Warning: '<' + '/' + letter not allowed here
 > line 5 column 1 - Warning: missing </script>
 > line 5 column 1 - Warning: missing </script>
 > ````
 >

Hi Oliver (alias=NoNoNo),

Sorry for the LONG delay in a response...

This is am important issue so have moved it to
here...

This issue has been around since the beginning,
so is more a 'Feature Request' than a bug ;=))
But what's in a label...

And yes, I wrote that patch back in 2007, inviting
discussion on this important topic of script
parsing... But as you can see got NO FEEDBACK ;=((

Now that the simple sample you provided PASSES
both validator.w3.org AND validator.w3.org/nu
maybe it is time to get serious as we head for a
new release 5.0.0...

So in the coming days/weeks/months I will implement
this feature, under a config option --skip-quotes
yes/no, as suggested way back then...

Will probably re-write the patch, hopefully adding
knowledge gained from continuing to work on Tidy
during the last 7-8 years...

The 'simple' idea is for Tidy to know it is parsing
a script, and skip over 'single' or "double"
quotes, and also skip comments, either inline //
or block /* .... */... thus not issue a warning
for say -
  var a = '<script>';

I still have to check the validators, and perhaps
in the html5 documentation, for any mention of
this, especially a closing tag like -
  var b = "</p>";
which the 'old' Tidy would 'escape' with -
  var b = "<\/p>";

That is, is this still required?

So really the ONLY discussion actively sought at
this time is whether the new option should default
to off or on ;=)) and any links to documentation,
and or more samples to check...

Regards,
Geoff.

Received on Tuesday, 27 January 2015 13:42:14 UTC