Take a look at the following code from one of the VueJS tutorial:
<form action="done.html" v-on:submit.prevent="handleIt">
<script>
// <model setup>
function handleIt() { doSomething(); }
</script>
This looks deadly like an old-school inline scripting, which we learned to avoid like the plague.
<button type="submit" onclick="doSomething(event);">
<script>
function doStuff(e) { e.preventDefault(); doOtherStuff(); }
</script>
Isn't the markup supposed to be just that?
You aren't the only one. It has seemed quite odd to me that we spent so much time preaching separation of concerns as THE best practice, only to completely shred it with front-end MVC frameworks.
I like the approach of React. Instead of shoehorning a new language into HTML, JSX brings markup to JavaScript, so that any non-markup code you write is always just JavaScript, which you already know, and it's always easy to tell which variables are in scope.
Jakub
Web Developer
Well it is kind of a weird example. Don't take it to serious.
However, if we talk about functionality, yes. It is back in the markup. But consider that we are not building static HTML pages, like years before.
We are building interactive interfaces and applications. So sure, you need functionality in the markup / templates.
But, we are moving out the business logic out of the templates into javascript. There were some heavy discussions about vue js filters in the 2.0 release. They should get removed, because filters were too much of logic that goes into the templates. Besides simple string operations like captialization etc.
One big use of filters was sorting and ordering, which in my mind is to much logic which goes into the templates. And you should avoid puting this stuff into your templates.