Why is colspan not a known native attribute in Angular 2?

后端 未结 3 748
情深已故
情深已故 2020-12-08 03:33

If we attempt code like this:

Column

or this:

Colu         


        
3条回答
  •  自闭症患者
    2020-12-08 04:19

    My question is, why is colspan not an attribute of the DOM, and if it is missing, how can the browser possibly render tables, since the browser renders the DOM and not the HTML?

    Colspan is an attribute of the DOM but it's not a property, so it's read only and browser renders it because it's an attribute.

    Also, if I open my Chrome inspector, and go to the properties tab, why can I see colspan as a property of the Element?

    The chrome shows both attributes and properties when you inspect it.

    If you consider following,

    
      
      
      
      
    AA
    B

    document.getElementById('xyz').colspan results in undefined Since it's not a property

    but document.getElementById('xyz').id results in xyz Since it's a property

提交回复
热议问题