Skip to content

Logically invalid HTML is messed up #435

Open

Description

@adrian-zon

Input:

<!DOCTYPE html>
<html>
  <head>
    <title>TITLE</title></head>
  <body>
    <table class=wrapper>
      <div class="parent">
        <table class="child"></table>
      </div>
    </table>
  </body>
</html>

Output:

<!DOCTYPE html><html><head>
    <title>TITLE</title></head>
  <body>
    <div class="parent">
        </div><table class="wrapper">
      </table><table class="child"></table>
      
    
  
</body></html>

Activity

  1. Stranger6667 commented on Mar 14, 2025

    @Stranger6667
    Owner

    It appears that missing quotes make html5ever parse it this way, or maybe this implementation can handle such cases, not 100% sure yet.

  2. adrian-zon commented on Mar 14, 2025

    @adrian-zon
    ContributorAuthor

    Oh sorry, it's not about the quotes, it's about putting a div directly in a table.

  3. Stranger6667 commented on Mar 14, 2025

    @Stranger6667
    Owner

    Right, I see it now! div can't be used in table as per the HTML spec and I see that e.g. chromium does a similar thing - https://jsfiddle.net/ELzs3/1/ (found that on SO) where div is ejected outside of table. It may work with quirks mode, but I need to try it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions