> Text inside script tags is parsed as JavaScript by default. It can be other languages too
It can be, but usually isn't.
> Again, it’s all just text in different syntax.
Again, it's not. And the reason is simple: the browser literally knows nothing about other syntaxes but Javascript [1]
So, no, "text in Vue" is literally not the same as "text in script tags". It is a mish-mash of:
- Vue's own DSL (see v-for)
- JS expressions that are wrapped in some scope (see v-if)
- JS-like DSL where function cals are not function calls, there are magic vars, but objects are also fine (see v-on)
- Maybe JS expressions in v-bind? But depends on the attribute name? Can use string concatenation, but anything else?
- Actual JS expressions in {{}} which can't be used just anywhere... but then these expressions can have pipes into filters in them? And filters once again are JS-like, but are not
None of this has any coherent specification, and we rely on Vue to properly parse and break it down into actual Javascript code that can then be included in a <script> tag.
Edit: I had the same laundry list of things for Svelte before Svelte 2, but Svelte 3 is significantly more consistent and coherent in what it expects in a template.
[1] There are ways to make it know other syntaxes, but that is rare and has largely fallen out of favor.