What consequences can I get with an undefined HTML element?

In an attempt to write more expressive HTML, I feel that custom HTML elements are a good way for any webapp or document that I can write to make good sense, sparkling from the tag name itself without using comments.

It seems I can define a custom HTML element with:

document.registerElement("x-el");

However, it also seems that I can use a custom element before defining it:

<body>
    <x-salamander>abc</x-salamander>
</body>

Or even:

<salamander>abc</salamander>

I assume this is invalid HTML, however both Firefox and Chromium continue to display the element without any problems or console warnings.

I can even do the following without any complaints in the browser:

document.getElementsByTagName("salamander")[0]

CSS . , , ?

+4
3

, , , , . , , , , . , , undefined, , , undefined.

, ! :

  • HTMLUnknownElement - , , - 5 , HTML5, HTML5, , undefined. registerElement , HTMLUnknownElement .
  • , , ... (.: quirks).
  • . Chrome, Firefox, Safari, Opera, IE, , ( pre-HTML5)... , (Lynx) , .
  • , : . , , , , , .

, , - , , , , , HTML5, , , . , HTML, .

+6

, , , IE8 . "css ", IE8. , , , .., CSS .

-, , jQuery , , HTML- . .

HTML-, , , .

+1

. AngularJS HTML , :

Angular HTML HTML. HTML HTML- . Angular .

The purpose of Angular is wider in that it treats HTML as if HTML was a tool for creating applications, not just displaying documents. For me, this broader goal gives real meaning and purpose for being able to extend HTML, as described in your question.

0
source

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


All Articles