Comment by q-rews
4 years ago
The distinction makes sense on documents but it starts to break on apps. Javascript depends on HTML and HTML is generated by JS.
4 years ago
The distinction makes sense on documents but it starts to break on apps. Javascript depends on HTML and HTML is generated by JS.
Your concept is right but that wording isn't quite right. JS runs fine without HTML and thousands of lines in any web app don't even touch HTML. Node is HTML-free, for example. Also, of course, HTML, can be generated in a thousand ways and has no dependencies on JS.
I think what you were going for is the idea that, beyond a trivial application, the visual appearance stuff is always going to be tied to some app logic or business logic or state or whatever word we want to use.
And that's very true regardless of what framework or language we choose.
You read that out of context. We’re talking about apps, web apps, SPAs, and specifically situations that bring you to mix HTML and CSS into a JavaScript module.
That situation most likely requires HTML (DOM) generation in the browser, which can only happen in JavaScript.
So, I reiterate, the HTML is generated by JS in these interactive modules.
You could generate the HTML on the server and then use jQuery to toggle elements… or just create full-JS components that take care of everything, giving some input data, instead of separating the HTML from the JS.