Re: [Tidy-dev] Solicit feedback on Script Parsing
Geoff McLane <[email protected]> Mon, 9 Mar 2015 17:20:08 +0100
| Newsgroups | gmane.comp.web.html-tidy.user,gmane.comp.web.html-tidy.devel |
|---|---|
| Message-ID | <CA+PgotKwu9FJiqqQM-uHQ4Q7r12rJCKoKVQ7jN=ToRX4uG=KHQ@mail.gmail.com> |
--f46d043c7b486589c70510dd68eb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, Mar 9, 2015 at 2:40 PM, Peter Hoffmann <[email protected]> wrote: > Doesn't > http://www.w3.org/TR/2014/REC-html5-20141028/scripting-1.html#restrictions-= for-contents-of-script-elements > say, that you must not use the string '<script=E2=80=A6' inside the script-element? @HoffmannP, thanks for that link. Yes, it does clearly indicate that `<script` should not be in a script element. However, if that is the case then the W3C validator is also in error by not flagging this as 'invalid'! Is this maybe a validator bug? But then what about the role of tidy as a 'fixer'. My patch could see this is in inverted commas, and could add the escaped `<\script` to successfully fix the document, probably with a warning. It just seems to me the current MESS that tidy outputs in this case is quite unacceptable - ```` <body> <script> var a =3D '<script'; <\/script> <\/body> <\/html> </script> </body> ```` Or alternatively at least to flag it as an error, thus no output unless forced. The idea is to not generate what would be seen as invalid javascript! That is a seriously compromised document. What do you think? Will also try to cross-post this to the lists to perhaps have a wider audience. --f46d043c7b486589c70510dd68eb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>On Mon, Mar 9, 2015 at 2:40 PM, Peter Hoffmann <<a= href=3D"mailto:[email protected]">[email protected]</a>> = wrote:</div><div>> Doesn't</div><div>> <a href=3D"http://www.w3.o= rg/TR/2014/REC-html5-20141028/scripting-1.html#restrictions-for-contents-of= -script-elements">http://www.w3.org/TR/2014/REC-html5-20141028/scripting-1.= html#restrictions-for-contents-of-script-elements</a></div><div>> say, t= hat you must not use the string '<script=E2=80=A6' inside the sc= ript-element?</div><div><br></div><div><div>@HoffmannP, thanks for that lin= k. Yes, it does clearly indicate that `<script` should not be in a scrip= t element.</div><div><br></div><div>However, if that is the case then the W= 3C validator is also in error by not flagging this as 'invalid'! Is= this maybe a validator bug?</div><div><br></div><div>But then what about t= he role of tidy as a 'fixer'. My patch could see this is in inverte= d commas, and could add the escaped `<\script` to successfully fix the d= ocument, probably with a warning.</div><div><br></div><div>It just seems to= me the current MESS that tidy outputs in this case is quite unacceptable -= </div><div><br></div><div>````</div><div><body></div><div><script&= gt;</div><div>var a =3D '<script';</div><div><\/script></d= iv><div><\/body></div><div><\/html></div><div></script></= div><div></body></div><div>````</div><div><br></div><div>Or alternati= vely at least to flag it as an error, thus no output unless forced. The ide= a is to not generate what would be seen as invalid javascript! That is a se= riously compromised document.</div><div><br></div><div>What do you think? W= ill also try to cross-post this to the lists to perhaps have a wider audien= ce.</div></div><div><br></div><div class=3D"gmail_extra"><br><div class=3D"= gmail_quote"><br></div></div></div> --f46d043c7b486589c70510dd68eb--