What's stopping me from using arbitrary tags in HTML?

前端 未结 7 921
礼貌的吻别
礼貌的吻别 2021-01-11 15:36

Even the new HTML5 tags aren\'t enough to describe structures without falling back to divs. What\'s stopping me from changing:

7条回答
  •  一整个雨季
    2021-01-11 16:24

    getElementsByTagName fails me with custom tags. Example,

    
        
    x
    y
    z

    This fails with IE8 (Quirks Mode or Standard Mode)

    var mytag = document.getElementById('mytag'); // it's found
    var mydivs = mytag.getElementsByTagName ('div'); // but this is always 0
    

    Unless your html tag reads

    
    ...
    
    

提交回复
热议问题