📜 ⬆️ ⬇️

alternative to html5 right now

While everyone is discussing HTML5, here I moved the convolutions and came up with, in general, a trivial, but useful concept and solution to all your problems with markup languages. It works now in Mozilla, WebKit and Opera.

To begin with, however, I will still say a few words about HTML5, so that it is clear what I am talking about. In my opinion, the authors of this language solve only current problems, which may simply become irrelevant by the time they are implemented in browsers. HTML5 is by definition not capable of perceiving new trends in web development on the fly and adapting to them.

But XML is capable of that. Theoretically, xhtml2 is just the embodiment of the ideas of modularity and extensibility. But there is one problem: you still need to wait for the browsers to support it. Now I will take the liberty to say the following: the browser should not learn a new markup language at all and developers should not wait for it to learn it. All that a browser should be able to do is handle xml, css and Javascript.
')
The concept is simple: completely separate the document structure , presentation and behavior . This is exactly what can be done today using xml, css and Javascript respectively. The script looks like this:

  1. Browser parsit xml document
  2. Browser parses css-styles that tell how elements should look and applies styles to a document
  3. The browser js engine performs Javascript, which describes how each page element should behave.

Please note that without styles, the browser does not know what to do with the <strong> element, for example. And without describing the behavior of the js script, the browser does not know how to behave when the user clicks the link. This approach can probably be called DSRB - Document Structure-Representation-Behavior.

And now I will show you, in fact, the page made in the manner described above, works in Mozilla, WebKit and Opera (there is a small incomprehensible glitch with a title in Opera) - look at the source code for sure. The disadvantage of this approach is that browsers do not want to perform Javascript if they think that they are in front of an XML document. For this reason, I had to specify the xhtml namespace and avoid standard HTML elements so that browsers do not define default styles and behavior for them. If browsers start to support Javascript for XML documents, the problem will be solved.

What is the advantage?


Savvy readers have already guessed that in this way you can implement HTML5 even today. In this case, you can add to the document you need a doctype or write your own DTD. Without a doctype, the document will be well-formed XML, which is also good.

In the future, if the idea takes root, I believe, there will be a lot of similar markup languages ​​in something. 2-3 of them, apparently, will be the most popular. But, most importantly, DSRB will allow you to create markup languages ​​that will start working in browsers right away.

Source: https://habr.com/ru/post/47503/


All Articles