Hacker News new | ask | show | jobs
by robertoandred 867 days ago
Vue files are absolutely not valid HTML.
2 comments

Template, script, and style are all valid tags.
Sure but that is as helpful as saying a Word document (.docx) is a valid ZIP file. The tags in Vue files are merely containers of the actually interesting stuff.
What matters for most (all?) tools is that the file is a valid HTML syntax. Most (all?) tools don’t care if the document it self is valid HTML. I don’t think I’ve used a single developer tool which stops working if I remove the <title> tag, nest <a> elements or even insert a self closing <div /> tag.
I think we're completely talking past each other. I was talking about type checking of TS, template and SCSS code inside a .vue file.
> A Vue SFC is syntactically compatible with HTML.

https://vuejs.org/api/sfc-spec.html

No, Vue’s template attributes are not valid html
Vue uses @:[]. in their attributes and these are valid HTML attribute syntax. HTML attribute syntax only disallows SPACE"'>/= and some specific code points. Everything else is valid syntax.

https://vuejs.org/guide/essentials/template-syntax.html

https://html.spec.whatwg.org/#attributes-2

This is not the point, the point is if they are valid JavaScript or TypeScript.