Codiga has joined Datadog!

Read the Blog
Skip to main content

HTML Element AST JavaScript Object

The HTML Element object matches a JavaScript HTML Element as the one you have in JSX.

The astType value for this node is htmlelement.

Code Pattern

This object captures the following code pattern.

return (
<MyComponent attr="val">
<div>
<ul>
<li>item</li>
</ul>
</div>
</MyComponent>
);

Attributes

  • tag (type AstString): the tag of the HTML object
  • openingTag (type HTML Tag): the tag element (with the position) of the opening tag
  • closingTag (type HTML Tag): the tag element (with the position) of the closing tag
  • attributes (array of type HTMLAttribute): the list of attributes
  • content (array of AstElement): arrays that contains all the children of an HTML node.

Examples of rules