Skip to content

Tidying incomplete <li> tag without <ul> returns unexpected html #725

@k-kyuno

Description

@k-kyuno

Hello.
I cleaned up the following html with tidy 5.6.0.

/work/html # cat missing_list_tag.html
<!DOCTYPE html>
<html>
<head>
<title>missing list tags</title>
</head>
<body>
<li>1st list item
<li>2nd list item
</body>
</html>

Then returned

/work/html # tidy --indent y -q missing_list_tag.html
line 8 column 1 - Warning: inserting implicit <ul>
line 8 column 1 - Warning: missing </ul>
<!DOCTYPE html>
<html>
  <head>
    <meta name="generator" content=
    "HTML Tidy for HTML5 for Linux version 5.6.0">
    <title>
      missing list tags
    </title>
  </head>
  <body>
    <li>1st list item
      <ul>
        <li>2nd list item
        </li>
      </ul>
    </li>
  </body>
</html>

I expected the following results, but the html obtained seems to be incorrect; It has changed semantically.
(Note: In tidy 5.2.0 returns the expected result. Attaching the doctype of html 4 in tidy 5.6.0 also returns the expected result.)

<!DOCTYPE html>
<html>
<head>
<title>missing list tags</title>
</head>
<body>
<ul>
<li>1st list item</li>
<li>2nd list item</li>
</ul>
</body>
</html>

I think that this is related to #525, but since <ul> is inserted, it seems like another problem.
And this issue also seems to be related:
#396 (This behavior was introduced?)
#572

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions