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

Suggestion. Add option to allow using self-closing tag on all HTML elements. #189

Open
Pentadome opened this issue May 27, 2024 · 2 comments

Comments

@Pentadome
Copy link

<div/>

This is not valid HTML. The browser will act like the closing tag doesn't exist, like so:

<div>

And vscode will correctly mark it as wrong like so:
image

But many html-like languages like Vue and JSX do allow self-closing tags, but vscode still marks it as wrong. It would be nice if we could allow all tags to be self-closed by setting a value in .vscode\settings.json

@DominoPivot
Copy link

DominoPivot commented Aug 28, 2024

The example you gave would cause an error in React because the DOM property is className, not class. JSX is not HTML, but an XML-like extension to JS that is processed into library code or DOM API calls.

Meanwhile, Vue allows for templates to be embedded in HTML, in which case they have to follow HTML syntax, and XML self-closing semantics do not apply in HTML as you pointed out (well, outside of foreign elements, like SVG).

In other words, VS Code is behaving as it should.

@Pentadome
Copy link
Author

The example you gave would cause an error in React because the DOM property is className, not class. JSX is not HTML, but an XML-like extension to JS that is processed into library code or DOM API calls.

Meanwhile, Vue allows for templates to be embedded in HTML, in which case they have to follow HTML syntax, and XML self-closing semantics do not apply in HTML as you pointed out (well, outside of foreign elements, like SVG).

In other words, VS Code is behaving as it should.

Please read again. This is not a bug report.

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

No branches or pull requests

2 participants