Today’s entrance is a change in the normal topics of the block, because you will be reading about changes, news and deprecations of HTML versión 5.2, an improvement in the HTML language. In my opinion, HTML is one of the most used languages, and very used when developing SPA (single page applications) and all action is taken hidden to the user.
The changes and improvements in the HTML language are not for free, are due to a demand from developers. Also, as the time goes on, new features are being demanded and other goes to deprecation.
Let’s start by what have been deprecated. The tags menu y menuitem, used for creating menus are deprecated, and in all my days as a developer, I never used them. I do not need them because Bootstrap have done an easy way of creating menus, also with a well-looking aspect, with no specific tags.
Also, the keygen, used to help generating public keys for forms, is deprecated, and I never used it!
Another change is related to tag <p>, because in HTML 5.2, the only valid children of a p element should be phrasing content, and the following types of elements should no longer be nested within a paragraph: inline block, inline table, float neither positioned or positioned block.
In my opinion, the more impact depretacion is related to doctype, because it won’t be neccesary any more. You won’t have to include:
<!DOCTYPE … ->
I can guess that using DOCTYPE had a sense, but with the update in the previous version, every thing was simplified … too much: introduction to HTML 5.
News in HTML 5.2
In my opinion, on of the most interesting features is the <dialog> tag, because it can seem a specific div for creating dialog boxes, a feature commonly used when developing SPA. By default, it is hidden, unless the attribute open is included:
The open attribute can me managed by the HTMLDialogElement, element, and it also gives you the methods show y close. This feature can be used with Chrome, and in the rest of the browsers it will be added in later versions.
More news comes with the Payment Request API, a native alternative to checkout forms. It aims to provide a standardised and consistent method of making payments on the web for users, by moving the handling of retrieving payment information to the browser, instead of individual checkout forms on each website.
I have never used this API and I don’t know how it works, but the fact of creating encrypted data can be seen as a more secured web, something that I like, and you should too!
For Apple users, there is news with the icons, because the browsers created by Apple don’t support the size property. The problem was solved by inventing apple-touch-icon as a solution for defining icons.
Cool features: main
Another cool feature is the option of defining more that one <main> element in the body of a page (before that version, it was allowed only one), but only one will be shoed at a time. The rest fo the elements will be hidden but also, you can use the hidden attribute. Again, web and SPA development requires this feature as a demand, and now it is available.
One last feature is related to CSS styles. By definition, they are set up in the <head>. Now with the increase in component-ized development, developers have seen the benefit in writing and placing styles along with the html element they are relevant for (and outside the <head>). Now it is possible.
In conclusion, it is your turn to put that knowledge into action! Happy coding!