prettyhtml: improperly closed textarea element unexpectedly slurps following content

🐛 Bug Report

Improper closing of <textarea> slurps up the rest of the content in the file (as opposed to adding a </textarea> tag and proceeding.

To Reproduce

Steps to reproduce the behavior: https://repl.it/repls/OnlyShabbyCgi

Paste your markup here:

<!doctype html>
<html class="no-js" lang="">
  <body>
    <p>Hello</p>
    <textarea />
    <p>World</p>
  </body>
</html>

creates

<!doctype html>
<html class="no-js" lang="">
<body>
  <p>Hello</p>
  <textarea/>
</body>
</html>

and

<!doctype html>
<html class="no-js" lang="">
  <body>
    <p>Hello</p>
    <textarea>
    <p>World</p>
  </body>
</html>

produces

<!doctype html>
<html class="no-js" lang="">
<body>
  <p>Hello</p>
  <textarea></textarea>
</body>
</html>

Expected behavior

keep the textarea element, close it, and keep following content, as browsers generally behave

Paste the results here:

<!doctype html>
<html class="no-js" lang="">
<body>
  <p>Hello</p>
  <textarea></textarea>
  <p>World</p>
</body>
</html>

Context

  • HTML5 only

Your Environment

  • Prettyhtml version: 0.1.5
  • NodeJs version: 9.7.1
  • Environment name and version: repl.it
  • Operating System and version: linux

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (13 by maintainers)

Most upvoted comments