Skip to content
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

Parsing error: Unterminated string constant when string includes "<body> #141

domenic opened this issue Mar 7, 2021 · 2 comments


Copy link

@domenic domenic commented Mar 7, 2021


When linting the following document:

<!DOCTYPE html>
<meta charset="utf-8">
<title>innerHTML to empty string</title>
<link rel="help" href="">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

  "use strict";

  test(() => {
    const doc = document.createElement("html");
    doc.innerHTML = "<head><title>foo</title></head><body>";

    doc.innerHTML = "";

    assert_true(doc.getElementsByTagName("body")[0] instanceof HTMLBodyElement);

  }, "Setting innerHTML to empty string");

I get

  13:21  error  Parsing error: Unterminated string constant

This goes away if I modify line 13 from

    doc.innerHTML = "<head><title>foo</title></head><body>";


    doc.innerHTML = "<head><title>foo</title></head>";

Setup configuration

Aditional context

This is occuring trying to upgrade jsdom from its current version as of today to the latest versions of ESLint and eslint-plugin-html.

Copy link

@BenoitZugmeyer BenoitZugmeyer commented Mar 7, 2021

Thank you for the report! This looks like an issue with htmlparser2, so I reported the issue there.

BenoitZugmeyer added a commit that referenced this issue Mar 8, 2021
Fixes #141
Copy link

@BenoitZugmeyer BenoitZugmeyer commented Mar 8, 2021

I upgraded htmlparser2, it should be fine now! Let me know how it works for you.

This was referenced Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants