Open Pentadome opened 3 months ago
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.
The example you gave would cause an error in React because the DOM property is
className
, notclass
. 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.
This is not valid HTML. The browser will act like the closing tag doesn't exist, like so:
And vscode will correctly mark it as wrong like so:
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