html - Why some HTML5 tags must have a starting and ending tag instead of self closing them with />? -


in html5 there tags must have starting , ending tag when content empty:

<script></script>   <!-- right way. --> <div></div>         <!-- right way. --> <content></content> <!-- right way. -->  <script/>  <!-- wrong way. --> <div/>     <!-- wrong way. --> <content/> <!-- wrong way. --> 

in xml difference doesn't exist: <node/> , <node></node> same entity.

why tags script, div , content can't defined as: <script/>, <div/> , <content/>?

from w3c:

a self-closing tag special form of start tag slash before closing right angle bracket. these indicate element closed immediately, , has no content. syntax permitted , used, end tag must omitted. in html, use of syntax restricted void elements , foreign elements. if used other elements, treated start tag. in xhtml, possible element use syntax. note conforming elements content models permit them empty.

the examples listed contain content, javascript, or other elements, having proper start , end tag delimit scope of elements/tags.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -