James Pearce: How I stopped worrying and learned to love the <body/>
As programmers it's our job to know the browser. We should be able to do everything in one place. Working with a good library helps.
Withour app has everything it needs to bootstrap its UI. All of the rich functionality is coming from JS. The DOM can look like a dog's dinner and the source can be even worse. Who said view source was a requirement for a web app?
There are benefits to abstracting code in libraries but you can do it easily yourself with vanilla JS and you can control how it behaves.
- no post load traversal
- scoped var references
- easily integrate or recurse
- no angle brackets on the wire - only curly brackets
- avoid mismatch between mark up and script
The only markup you have to add is bootsrapping the script. Everything else can be added via JS.
This is the full code of an index.html document that will work.
There is no one way to do web.
There are a number of ways to approach the web - it's not a religion.
<body/> is a metaphor - we can view the web in many ways, often in ways we don't think of. It signifies that the web can be a first class app system.
<input type="submit"/> is when the web started becoming read/ write. WAP/ WML was ahead of its time, the modern web is still trying to catch up with it.
The web needs to fight to catch up as an app platform. Native vs. web debate shows this. "The web will always win" is just an opinion. "The web is wearing out" - the technology is 20 years old. Full page loads for the full UI is not the best way to go which is why we have AJAX. Forms with local storage and data manipulation are the next stage.
What can we learn from the technology in people's hands? The web needs a connection, we don't always have that. Closer to the hardware usually leads to a better experience.
Go out and build awesome things!