commit
949ad9dae3
4
regression_testing/cases/github-cases/case-523.conf
Executable file
4
regression_testing/cases/github-cases/case-523.conf
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
# Config for test case.
|
||||||
|
tidy-mark: no
|
||||||
|
indent: no
|
||||||
|
wrap: 99999
|
28
regression_testing/cases/github-cases/case-523@1.html
Normal file
28
regression_testing/cases/github-cases/case-523@1.html
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<!--
|
||||||
|
This test case is for issue #523, in which a space is placed after the
|
||||||
|
closing tag of certain elements. For example below, a space is added after
|
||||||
|
the first script closing tag and after the img tag.
|
||||||
|
-->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>test</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
</script>
|
||||||
|
<h1>Hello</h1>
|
||||||
|
<script type="text/javascript">
|
||||||
|
</script>
|
||||||
|
<img src="hi.jpg">
|
||||||
|
<script type="text/javascript">
|
||||||
|
</script>
|
||||||
|
<p>This is a block level element, and as such, is capable of inlining inline elements.<script type="text/javascript">let x = "Hello, world"</script> Scripts are inline elements, so this script should be included in the flow.</p>
|
||||||
|
<script type="text/javascript"></script><img src="bye.jpg"><script type="text/javascript"></script>
|
||||||
|
<hr>
|
||||||
|
<p>This is another paragraph with an <img src="meh.jpg"> tag inline.</p>
|
||||||
|
<img src="one.jpg"><img src="two.jpg"><img src="three.jpg">
|
||||||
|
</body>
|
||||||
|
</html>
|
27
regression_testing/cases/github-expects/case-523.html
Normal file
27
regression_testing/cases/github-expects/case-523.html
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<!--
|
||||||
|
This test case is for issue #523, in which a space is placed after the
|
||||||
|
closing tag of certain elements. For example below, a space is added after
|
||||||
|
the first script closing tag and after the img tag.
|
||||||
|
-->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>test</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript"></script>
|
||||||
|
<script type="text/javascript"></script>
|
||||||
|
<h1>Hello</h1>
|
||||||
|
<script type="text/javascript"></script><img src="hi.jpg">
|
||||||
|
<script type="text/javascript"></script>
|
||||||
|
<p>This is a block level element, and as such, is capable of inlining inline elements.
|
||||||
|
<script type="text/javascript">
|
||||||
|
let x = "Hello, world"
|
||||||
|
</script> Scripts are inline elements, so this script should be included in the flow.</p>
|
||||||
|
<script type="text/javascript"></script><img src="bye.jpg">
|
||||||
|
<script type="text/javascript"></script>
|
||||||
|
<hr>
|
||||||
|
<p>This is another paragraph with an <img src="meh.jpg"> tag inline.</p>
|
||||||
|
<img src="one.jpg"><img src="two.jpg"><img src="three.jpg">
|
||||||
|
</body>
|
||||||
|
</html>
|
26
regression_testing/cases/github-expects/case-523.txt
Normal file
26
regression_testing/cases/github-expects/case-523.txt
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
line 19 column 1 - Warning: <img> lacks "alt" attribute
|
||||||
|
line 23 column 41 - Warning: <img> lacks "alt" attribute
|
||||||
|
line 25 column 38 - Warning: <img> lacks "alt" attribute
|
||||||
|
line 26 column 1 - Warning: <img> lacks "alt" attribute
|
||||||
|
line 26 column 20 - Warning: <img> lacks "alt" attribute
|
||||||
|
line 26 column 39 - Warning: <img> lacks "alt" attribute
|
||||||
|
Info: Document content looks like HTML5
|
||||||
|
Tidy found 6 warnings and 0 errors!
|
||||||
|
|
||||||
|
The alt attribute should be used to give a short description
|
||||||
|
of an image; longer descriptions should be given with the
|
||||||
|
longdesc attribute which takes a URL linked to the description.
|
||||||
|
These measures are needed for people using non-graphical browsers.
|
||||||
|
|
||||||
|
For further advice on how to make your pages accessible
|
||||||
|
see https://www.w3.org/WAI/GL.
|
||||||
|
About HTML Tidy: https://github.com/htacg/tidy-html5
|
||||||
|
Bug reports and comments: https://github.com/htacg/tidy-html5/issues
|
||||||
|
Official mailing list: https://lists.w3.org/Archives/Public/public-htacg/
|
||||||
|
Latest HTML specification: https://html.spec.whatwg.org/multipage/
|
||||||
|
Validate your HTML documents: https://validator.w3.org/nu/
|
||||||
|
Lobby your company to join the W3C: https://www.w3.org/Consortium
|
||||||
|
|
||||||
|
Do you speak a language other than English, or a different variant of
|
||||||
|
English? Consider helping us to localize HTML Tidy. For details please see
|
||||||
|
https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md
|
16
src/parser.c
16
src/parser.c
|
@ -414,6 +414,14 @@ static Bool CleanLeadingWhitespace(TidyDocImpl* ARG_UNUSED(doc), Node* node)
|
||||||
if (node->parent->tag && node->parent->tag->parser == TY_(ParseScript))
|
if (node->parent->tag && node->parent->tag->parser == TY_(ParseScript))
|
||||||
return no;
|
return no;
|
||||||
|
|
||||||
|
/* #523, prevent blank spaces after script if the next item is script.
|
||||||
|
* This is actually more generalized as, if the preceding element is
|
||||||
|
* a body level script, then indicate that we want to clean leading
|
||||||
|
* whitespace.
|
||||||
|
*/
|
||||||
|
if ( node->prev && nodeIsSCRIPT(node->prev) && nodeIsBODY(node->prev->parent) )
|
||||||
|
return yes;
|
||||||
|
|
||||||
/* <p>...<br> <em>...</em>...</p> */
|
/* <p>...<br> <em>...</em>...</p> */
|
||||||
if (nodeIsBR(node->prev))
|
if (nodeIsBR(node->prev))
|
||||||
return yes;
|
return yes;
|
||||||
|
@ -454,6 +462,14 @@ static Bool CleanTrailingWhitespace(TidyDocImpl* doc, Node* node)
|
||||||
if (node->parent->tag && node->parent->tag->parser == TY_(ParseScript))
|
if (node->parent->tag && node->parent->tag->parser == TY_(ParseScript))
|
||||||
return no;
|
return no;
|
||||||
|
|
||||||
|
/* #523, prevent blank spaces after script if the next item is script.
|
||||||
|
* This is actually more generalized as, if the next element is
|
||||||
|
* a body level script, then indicate that we want to clean trailing
|
||||||
|
* whitespace.
|
||||||
|
*/
|
||||||
|
if ( node->next && nodeIsSCRIPT(node->next) && nodeIsBODY(node->next->parent) )
|
||||||
|
return yes;
|
||||||
|
|
||||||
next = node->next;
|
next = node->next;
|
||||||
|
|
||||||
/* <p>... </p> */
|
/* <p>... </p> */
|
||||||
|
|
Loading…
Reference in a new issue