Last Updated: February 25, 2016
·
548
· nickeyz

I'm still gonna use the " />" self-close!

Last couple of days I was wondering around the self-closing tags in w3c's html5 specs.

Looking at the input filed: <input type="text"></code>, it somehow naturally doesn't look good. Many hardcore developers I know are stating, that html&js are "super chaotic" languages, where order is forbidden. In some cases I tend to agree, even if I'm far away from a backend developer.

When xml code convention was applied in xhtml, it just went so flawlessly to follow the basic rule: each tag you use, must have a closing tag, or if a void tag - then self-close it by "/". Simple and clean.

Now what w3c states is that you can go either ways, and it's ok, but HTML is not a self-operating script. As HTML is more a representational layer, we do have js for example, handling the logic layer. That said, if we have a control, with an "assuming behavior" like the self close, just think about the assumption that js will make, if handling a task of "find me all closed tags"...