Why do browsers parse custom tags in HTML5?

Possible duplicate:
Can I use unknown HTML tags?

I tested my own <oles-tag> ... </oles-tag> in Chrome and IE9.

I am using HTML5 doctype <!DOCTYPE html> .

HTML5 does NOT support custom tags. The code will not be checked, but browsers analyze it anyway. I can even customize it using CSS ...

Why do browsers parse custom tags when it doesn't standardize valid code?

And why shouldn't I use custom tags for semantic code?

+4
source share
2 answers

Why do browsers parse custom tags when it's not standardized and not valid?

Make it compatible with the transition. Imagine if it wasn’t possible for you to style the <article> elements in old browsers, because the <article> didn’t exist when these old browsers were written. That would be awful, right? glare in IE

And why shouldn't I use custom tags for semantic code?

Because no one else (program) recognizes those tags, so they are not semantic. The reason that elements such as <article> are considered semantic is because they have an established use. When you use a user element that does not have an established use, it can be interpreted in several ways, which leads to inconsistency between programs. glare in <b> and <i>

+9
source

Browsers are generally lenient with markup. This is partly historically associated with difficulties in adopting the complex SGML syntax.

In the late 90s there was a movement towards rigor, which led to the creation of XHTML , where every error leads to a catastrophic failure. If you prefer rigor, there seems to be a version of XHTML adapted for HTML5 .

XHTML has another interesting feature - you can define and use your own tags that you want, in fact this was one of two main reasons for this development.

0
source

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


All Articles