Merge pull request #989 from htacg/issue_464
Fixes #464. Test cases added.
This commit is contained in:
commit
172d5a888c
3
regression_testing/cases/github-cases/case-464a.conf
Normal file
3
regression_testing/cases/github-cases/case-464a.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
tidy-mark: no
|
||||
wrap: 0
|
||||
indent: yes
|
29
regression_testing/cases/github-cases/case-464a@1.html
Normal file
29
regression_testing/cases/github-cases/case-464a@1.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
<!--
|
||||
This test case represents HTML Tidy issue #464, which describes
|
||||
a descrepancy between tidy's behavior and the W3C Nu HTML
|
||||
checker behavior. In this case, <dl> is now allowed to contain
|
||||
a div as a descendent in HTML5.
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Issue #464</title>
|
||||
</head>
|
||||
<body>
|
||||
<dl>
|
||||
<dt>term</dt>
|
||||
<dd>def</dd>
|
||||
<dt>another term<dt>
|
||||
<dd>another def</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<div>
|
||||
<dt>term</dt>
|
||||
<dd>def</dd>
|
||||
<dt>another term<dt>
|
||||
<dd>another def</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</body>
|
||||
</html>
|
3
regression_testing/cases/github-cases/case-464b.conf
Normal file
3
regression_testing/cases/github-cases/case-464b.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
tidy-mark: no
|
||||
wrap: 0
|
||||
indent: yes
|
29
regression_testing/cases/github-cases/case-464b@1.html
Normal file
29
regression_testing/cases/github-cases/case-464b@1.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
<!--
|
||||
This test case represents HTML Tidy issue #464, which describes
|
||||
a descrepancy between tidy's behavior and the W3C Nu HTML
|
||||
checker behavior. In this case, <dl> is now allowed to contain
|
||||
a div as a descendent in HTML5.
|
||||
-->
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Issue #464</title>
|
||||
</head>
|
||||
<body>
|
||||
<dl>
|
||||
<dt>term</dt>
|
||||
<dd>def</dd>
|
||||
<dt>another term<dt>
|
||||
<dd>another def</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<div>
|
||||
<dt>term</dt>
|
||||
<dd>def</dd>
|
||||
<dt>another term<dt>
|
||||
<dd>another def</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</body>
|
||||
</html>
|
47
regression_testing/cases/github-expects/case-464a.html
Normal file
47
regression_testing/cases/github-expects/case-464a.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
<!--
|
||||
This test case represents HTML Tidy issue #464, which describes
|
||||
a descrepancy between tidy's behavior and the W3C Nu HTML
|
||||
checker behavior. In this case, <dl> is now allowed to contain
|
||||
a div as a descendent in HTML5.
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>
|
||||
Issue #464
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<dl>
|
||||
<dt>
|
||||
term
|
||||
</dt>
|
||||
<dd>
|
||||
def
|
||||
</dd>
|
||||
<dt>
|
||||
another term
|
||||
</dt>
|
||||
<dd>
|
||||
another def
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<div>
|
||||
<dt>
|
||||
term
|
||||
</dt>
|
||||
<dd>
|
||||
def
|
||||
</dd>
|
||||
<dt>
|
||||
another term
|
||||
</dt>
|
||||
<dd>
|
||||
another def
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</body>
|
||||
</html>
|
20
regression_testing/cases/github-expects/case-464a.txt
Normal file
20
regression_testing/cases/github-expects/case-464a.txt
Normal file
|
@ -0,0 +1,20 @@
|
|||
line 17 column 21 - Warning: trimming empty <dt>
|
||||
line 24 column 21 - Warning: trimming empty <dt>
|
||||
Info: Document content looks like HTML5
|
||||
Tidy found 2 warnings and 0 errors!
|
||||
|
||||
One or more empty elements were present in the source document but
|
||||
dropped on output. If these elements are necessary or you don't want
|
||||
this behavior, then consider setting the option "drop-empty-elements"
|
||||
to no.
|
||||
|
||||
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
|
52
regression_testing/cases/github-expects/case-464b.html
Normal file
52
regression_testing/cases/github-expects/case-464b.html
Normal file
|
@ -0,0 +1,52 @@
|
|||
<!--
|
||||
This test case represents HTML Tidy issue #464, which describes
|
||||
a descrepancy between tidy's behavior and the W3C Nu HTML
|
||||
checker behavior. In this case, <dl> is now allowed to contain
|
||||
a div as a descendent in HTML5.
|
||||
-->
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>
|
||||
Issue #464
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<dl>
|
||||
<dt>
|
||||
term
|
||||
</dt>
|
||||
<dd>
|
||||
def
|
||||
</dd>
|
||||
<dt>
|
||||
another term
|
||||
</dt>
|
||||
<dd>
|
||||
another def
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dd>
|
||||
<div>
|
||||
<dl>
|
||||
<dt>
|
||||
term
|
||||
</dt>
|
||||
<dd>
|
||||
def
|
||||
</dd>
|
||||
<dt>
|
||||
another term
|
||||
</dt>
|
||||
<dd>
|
||||
another def
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</dd>
|
||||
</dl>
|
||||
</body>
|
||||
</html>
|
25
regression_testing/cases/github-expects/case-464b.txt
Normal file
25
regression_testing/cases/github-expects/case-464b.txt
Normal file
|
@ -0,0 +1,25 @@
|
|||
line 21 column 4 - Warning: missing <dd>
|
||||
line 21 column 4 - Warning: missing </div> before <dt>
|
||||
line 22 column 5 - Warning: inserting implicit <dl>
|
||||
line 22 column 5 - Warning: missing </dl> before </div>
|
||||
line 17 column 21 - Warning: trimming empty <dt>
|
||||
line 24 column 21 - Warning: trimming empty <dt>
|
||||
Info: Doctype given is "-//W3C//DTD HTML 4.01//EN"
|
||||
Info: Document content looks like HTML Proprietary
|
||||
Tidy found 6 warnings and 0 errors!
|
||||
|
||||
One or more empty elements were present in the source document but
|
||||
dropped on output. If these elements are necessary or you don't want
|
||||
this behavior, then consider setting the option "drop-empty-elements"
|
||||
to no.
|
||||
|
||||
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
|
|
@ -1115,6 +1115,11 @@ Node* TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if ( nodeIsDIV(element) && nodeIsDL(element->parent) && TY_(IsHTML5Mode)(doc) )
|
||||
{
|
||||
return TY_(ParseDefList)(doc, element, mode);
|
||||
}
|
||||
|
||||
if ( nodeIsFORM(element) &&
|
||||
DescendantOf(element, TidyTag_FORM) )
|
||||
TY_(Report)(doc, element, NULL, ILLEGAL_NESTING );
|
||||
|
@ -2311,7 +2316,7 @@ Node* TY_(ParseDefList)( TidyDocImpl* doc, Node *list, GetTokenMode mode )
|
|||
}
|
||||
}
|
||||
|
||||
if ( !(nodeIsDT(node) || nodeIsDD(node)) )
|
||||
if ( !( nodeIsDT(node) || nodeIsDD(node) || ( nodeIsDIV(node) && TY_(IsHTML5Mode)(doc) ) ) )
|
||||
{
|
||||
TY_(UngetToken)( doc );
|
||||
|
||||
|
@ -2340,7 +2345,7 @@ Node* TY_(ParseDefList)( TidyDocImpl* doc, Node *list, GetTokenMode mode )
|
|||
continue;
|
||||
}
|
||||
|
||||
/* node should be <DT> or <DD>*/
|
||||
/* node should be <DT> or <DD> or <DIV>*/
|
||||
TY_(InsertNodeAtEnd)(list, node);
|
||||
{
|
||||
TidyParserMemory memory = {0};
|
||||
|
|
Loading…
Reference in a new issue