The Elements panel represents the DOM tree as a collection of nodes. Each node's primary visual representation—its “title”—is a dynamic string of text, interactive links, and syntax-highlighted code. This specification documents the expected user-facing behaviors of the node title rendering across various DOM node types, ensuring a rich, interactive, and accurate representation of the document structure.
Node.ELEMENT_NODE)Element nodes are the most common nodes in the tree. Their rendering depends on their state:
<tagName attribute="value"> for opening tags and </tagName> for closing tags. The tag names are syntax-highlighted.::pseudo-element-name(identifier).<div>Hello</div>), it is rendered entirely on one line: <tagName>Hello</tagName>. The text content has its whitespace collapsed, and HTML entities are syntax-highlighted.▶), a visually hidden … (for accessibility and layout tests), and the closing tag, all on one line.Attributes within Element nodes have complex interactive behaviors:
name="value". If an attribute has no value, the ="value" part is omitted unless explicitly forced.src and href attributes, as well as complex srcset definitions in <img>, <source>, and <image> tags, are automatically detected. They are rendered as clickable links that open the resource or show an image preview popover on hover.popovertarget, interesttarget, commandfor) are parsed. Their values are rendered as clickable links that, when clicked, reveal the target DOM node in the Elements panel. Tooltips will read: “Reveal Popover Target”, “Reveal Interest Target”, or “Reveal Command For Target” respectively.Node.TEXT_NODE)"text"). HTML entities within the text are highlighted.<script>: If the parent is a <script> tag, the text is treated as code. Quotes are omitted, whitespace is trimmed, and the content is passed through the JavaScript syntax highlighter.<style>: If the parent is a <style> tag, the text is treated as code. Quotes are omitted, whitespace is trimmed, and the content is passed through the CSS syntax highlighter.Node.COMMENT_NODE): Rendered exactly as <!-- comment text -->.Node.DOCUMENT_TYPE_NODE): Rendered in the format <!DOCTYPE name PUBLIC "publicId" "systemId" [internalSubset]>. Only the applicable parts of the doctype are displayed.Node.CDATA_SECTION_NODE): Rendered as <![CDATA[text]]>.Node.DOCUMENT_NODE): Rendered as #document (url) where the URL is a clickable link.Node.DOCUMENT_FRAGMENT_NODE): Rendered as the fragment name, with whitespace collapsed (e.g., #document-fragment). Shadow roots also receive specific CSS classes to indent them appropriately (shadow-root, shadow-root-deep, etc.).When the DevTools backend reports a change to a node (via an ElementUpdateRecord), the specific portion of the title that changed must briefly flash with a purple highlight (dom-update-highlight CSS animation):
When a user executes a search within the Elements panel (Ctrl/Cmd + F), matches found within the text representation of the node title are highlighted with a distinct yellow background span. This highlight spans across Tag names, attributes, and text values.
Specific semantic markers like slot, grid, flex, and popover markers are appended to the title but managed via a separate layout/adorner system, overlaying on the line.