-
Notifications
You must be signed in to change notification settings - Fork 429
Tidy fails on style block with comment block #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@cmd thank you for this issue, and yes the sample html you pointed to, now imbedded here, is a perfect example of the big problem in tidy ;=((
This sample In all browser tried shows the text Nor does it seem the browsers tested open a second level of This tripping over a second This tidy counting of the opens of the container, in the GetCDATA(...) service, was introduced a long time ago into the code. And this increment of a I think the BUT, this is a different bug, like supporting So that does not show, or explain the reason for the My suggestion is to add another option TidySkipComments. When this is enabled, on getting a This option is similar to the TidySkipQuotes recently inroduced, #65, to get over problems in the This new option, TidySkipComments, could default to The W3C seems to allow this comment block addition to the The relevant quote is "The textContent of a style element must match the style production in the following ABNF, the character set for which is Unicode."
This seems to indicate that when there is a comment block open As usual, with changes in such old established code are considered, look for to comments from others before implementing... thanks... |
@foxinushka opened a similar issue, Tidy fails with following HTML #283, now transferred here.. Test html: If I remove
after In this case the in container counter is incremented on finding a comment block with another style open - |
@cmd @foxinushka see #65 for a possible fix pushed to the I hope you will get a chance to do |
I've checked the fix. The behaviour is the same as I described in #283. |
@foxinushka well I have re-tested your dropbox test.html and find no problem now...
You must use tidy version For this sample you must use the Without that additional config option set to on the whole file becomes just one style block, with just 2 warnings. And using -i, the output ends with the very bad - <!-- end footer-->
</tbody>
</table>
</body>
</html>
</style>
</head>
<body>
</body>
</html> With that option on you will get some 27 warnings, and using -i the output ends correctly with - </tr><!-- end footer-->
</tbody>
</table>
</body>
</html> Very puzzled... Please check again and advise... |
Sorry, I've forgotten to enable TidySkipQuotes option. Now it works. Thanks! |
@foxinushka no problem... And make a clear note the name of this option And of course |
This seems to be fixed for me. |
Two confirmations of a fix, and a check of the cases using master branch incline me toward closing this issue. Thanks, everyone. |
When Tidy encounters a style block with a comment block, it does not
parse the comment block correctly.
In fact, it will be confused if the comment block contains HTML, such
as an opening style tag.
Example:
http://the-brannons.com/styletest1.html
This also affects script tags, apparently.
Using a comment inside style or script was a way to hide the
contents from old browsers that don't understand the style or script tags,
so that they didn't try to render their contents as text.
It's apparently still being used in some HTML 5 pages. How should it
be handled today, by Tidy?
The text was updated successfully, but these errors were encountered: