Element Tag

TagPartMap

Maps an element's tag to a string value that will be used as a part value for elements with that tag.

Tag names are lowercase. Can map any number of tags to part values.

Optional second parameter of the assignTagToPart() function.

The TagPartMap object is a configuration object and each of its properties act like keys. It does not expose any methods.

Properties

Name Description Value Type Default Value
[ HTMLElement tag ]

The tag name of any well-known HTML element.

The configuration object may include any number or HTML tags as properties.

The value that those properties are set to is a string value that will be assigned as a part for all elements with tags that match the key.

string
undefined

Methods

This object does not expose any methods.

assignTagToPart

Return Type
undefined

Takes a shadow root and an optional configuration object as parameters and then queries for all of its decendant nodes.

For each element returned by the query, the function assigns the element's tag to its part attribute.

Parameters

Name Description Value Type Default Value
shadowRoot

The shadow root of the target custom element.

ShadowRoot
undefined
config?

Optional

A TagPartMap object that maps element tag names to part assignment.

TagPartMap
undefined