Page 2 of 2
Before you argue that this is difficult I should point out that this is possible in other "markup" languages like XAML. In this case instead of viewing the markup language as semantic in the narrow non-programmatic sense we consider it to be integral to the programming language.
In fact XAML is an object instantiation and initialisation language. When you use a tag in XAML it is a shorthand for create an object of the same name and when you use an attribute in XAML this initialises a property of the same name. That is, the markup language is deeply integrated with the programming language.
In this new architecture you could create new HTML controls on an equal footing with what used to be thought of as "standard" HTML controls.
Let's get a VM
Suddenly language support just becomes a matter of having a compiler that targets the correct VM.
A new view
None of these ideas would effect the way that HTML/CSS is currently used.
Designers could ignore the fact that it was anything but a mark-up language - as designers do with XAML say. They could apply styles using CSS ignorant of the fact that it was backed by a language subsystem.
Of course all of this misses the point that at the end of the say we don't want to be working with raw HTML/CSS anyway. Picking over the syntax of HTML is like having to work with assembly language in a text editor. Yes some like to do it and regard it as the only true way to program - but it isn't productive.
What we really need is an integrated development environment complete with modern facilities such as interactive debugging, drag-and-drop layout, single stepping, breakpoints, unit tests, auto-documentation, source code management and so on.
Such environments would be much easier to create with a stronger integration between HTML and language facilities.
All you have to do is see web app development as being no different from any other sort of development and demand the same facilities and you quickly realise how feeble a step HTML5 is and how far we are away from anything sensible.
There are lots of other ways in which the browser environment could be improved to make programming easier and more powerful - we just have to put HTML into its proper place and make the programming the top of the stack.
I hate to be a Marvin but yes - HTML5 - I've seen it. It's rubbish.