Reputation: 536
In the HTML specification there is a concept called custom elements. There is a definite expression to which the names of these elements should follow. But, however, after opening the editor in the browser, we can safely write elements that do not follow these rules, or simply create a simple page with elements that do not follow this rule. For example, <redcar> </redcar>
. Why is this allowed and does not cause any errors? After all, if we write something like this: <~hello> </~hello>
then the opening tag will be treated as text, and the closing tag will be commented out. In any case, you need specific links that will explain this behavior.
A valid custom element name is a sequence of characters name that meets all of the following requirements:
- name must match the PotentialCustomElementName production:
PotentialCustomElementName ::=
[a-z] (PCENChar)* '-' (PCENChar)*
PCENChar ::=
"-" | "." | [0-9] | "_" | [a-z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
This uses the EBNF notation from the XML specification. [XML]
- name must not be any of the following:
annotation-xml
color-profile
font-face
font-face-src
font-face-uri
font-face-format
font-face-name
missing-glyph
Upvotes: 3
Views: 944
Reputation: 9636
Of course errors are caused. You can find them here:
If the errors were fatal, i.e. after an error the browser would stop rendering the page, Google would be out of business because so few web sites would be on-line that one could easily memorize them.
Upvotes: 0
Reputation: 136856
It's unclear what you'd consider an error.
HTML parsing is mainly oriented toward a never throw principle, and will try to convert everything to something valid.
In your specific case, what you created is an HTMLUnknownElement, and this follows the specs:
The element interface for an element with name name in the HTML namespace is determined as follows:
If name is
applet
,bgsound
,blink
,isindex
,keygen
,multicol
,nextid
, orspacer
, then return HTMLUnknownElement.If name is
acronym
,basefont
,big
,center
,nobr
,noembed
,noframes
,plaintext
,rb
,rtc
,strike
, ortt
, then return HTMLElement.If name is
listing
orxmp
, then return HTMLPreElement.Otherwise, if this specification defines an interface appropriate for the element type corresponding to the local name name, then return that interface.
If other applicable specifications define an appropriate interface for name, then return the interface they define.
If name is a valid custom element name, then return HTMLElement.
Return HTMLUnknownElement.
With <redcar></redcar>
you gone the whole way until bullet #7.
Upvotes: 7