In my web application I would like to complately avoid html and use only javascript to create web-page's dom tree.
What is faster writing web content in the traditional way in html <div>Some text</div>
or using javascript dom render, like this: div.appendChild(document.createTextNode("Some text"));
?
Use Javascript to inject HTML only if the site is meant to work without an Internet connection, or a similar case.
JavaScript simply adds dynamic content to websites to make them look good. HTML work on the look of the website without the interactive effects and all. HTML pages are static which means the content cannot be changed. It adds interactivity to web pages to make them look good.
Javascript has some helpful methods that allow us create HTML elements. This is important in cases where we do not want to hard-code the markup but rather generate them dynamically when certain events happen in the browser.
JavaScript AdvantagesSpeed − JavaScript is a "interpreted" language, it cuts down on the time needed for compilation in other programming languages like Java. Another client-side script is JavaScript, which accelerates programme execution by eliminating the wait time for server connections.
Stick with the traditional HTML. It's not only faster than doing everything with javascript, it's much more maintainable.
Unless there is a compelling reason otherwise, stick with the straight up HTML and use javascript for the more interactive pieces of your app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With