Can you define your own self-closing tag in HTML5? -


i have read this topic, still have doubts. there way define void tag?

i tried this:

<icon class="home"/> (know slash isn't obligatory) 

but, if there text content after tag ff closes them.

<icon class="home"/> go home 

makes

<icon class="home">go home</icon> 

should define somewhere tag void-element? or impossible html5?

this not answer because not address question, did not fit comment section.

the / in /> ignored browsers if parsed html5 specs (except foreign elements of mathlm , svg, because elements of modules specs has self enclosing element, there needs stay valid)

relevant parts of specs:

(the relevant part how browsers should handle missing tags , ignore / missing, need up)

if element void element no closing tag generated, because not require one.

for other elements closing tag created if missing. if write this:

<div>     <div/>test </div> 

it result in

<div>     <div>test</div> </div> 

because / ignored.

custom elements non-void default. know there draft custom elements don't know if supported in browsers. if is, have problem of backward compatibility. not recommend use it.

even defining tag name not prefixed x- bad idea because if later element added specs name choose , if has meaning have problem.

as have time specs i'll provide corresponding missing parts proof this.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -