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

</textarea> with the closing angle bracket at a new line gives error #6276

Closed
outloudvi opened this issue May 1, 2021 · 5 comments · Fixed by #6424
Closed

</textarea> with the closing angle bracket at a new line gives error #6276

outloudvi opened this issue May 1, 2021 · 5 comments · Fixed by #6424
Labels

Comments

@outloudvi
Copy link
Contributor

outloudvi commented May 1, 2021

Describe the bug
</textarea> with the closing angle bracket at a new line gives error.

Logs

Unexpected end of input (2:1)

To Reproduce

<textarea>test</textarea
>

Expected behavior
Does not give error.

Stacktraces
(None)

Information about your Svelte project:

  • Your browser and the version: Firefox Nightly 2021-05-01
  • Your operating system: Arch Linux
  • Svelte version: 3.38.1
  • Whether your project uses Webpack or Rollup: Maybe unrelated, since it reproduces on REPL.

Severity
Not much, but it conflicts with my prettier configurations sometimes.

Additional context

The case with <textarea> gives error, but interestingly the case with <div> does not.


EDIT: Got it saved in REPL here.

@Conduitry Conduitry added the bug label May 2, 2021
@Conduitry
Copy link
Member

Yeah it would be nice to match browsers' behavior for parsing the end of textareas. I'm not sure what that is exactly though.

@dummdidumm
Copy link
Member

I always thought that for all browsers it does not matter where the > is at, and that is doesn't need to be right after the tag name. Since Prettier does this for all tags I'd be surprised if it doesn't work for textarea

@akqira
Copy link

akqira commented May 9, 2021

@dummdidumm : i confirm that browsers (chrome, safari, Firefox) are handling correctly even if the closing sign > is not right after the tag name </textarea

After having a closer look it seems that the parser is checking for the exact string '</textarea>' without space or breaking line after the tag name

parser.template.slice(parser.index, parser.index + 11) === '</textarea>'

I did a try using regex test /\/textarea\s*>/mi and it seems returning true value when there is spaces/lines-break, but it also generates another error </textarea> attempted to close an element that was not open (svelte) after line 224 so it will need more time to implement correctly the logic and relative tests.

Is it ok to continue with this regex approach or do you suggest something else ? @dummdidumm @Conduitry

@tanhauhau
Copy link
Member

@Conduitry
Copy link
Member

This parses correctly now in 3.38.3 - https://svelte.dev/repl/027e752c415f4f12895f714232c5a186?version=3.38.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants