exportparts Features

PartExportPartMap

Maps how an element's part values are assigned as exportparts values.

Optional third parameter of the assignPartsAsExportPartsAttribute() and getExportPartsFromParts() functions.

The PartExportPartMap 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
[ part value ]

A part value on an element in the target shadow root.

string
undefined

Methods

This object does not expose any methods.

assignPartsAsExportPartsAttribute

Return Type
undefined

For each element in the shadow root used as the function's first parameter, the function assigns the element's part attribute values to its parent's exportparts attribute.

By default, the function will not add newlines to the exportparts attribute value. For debugging purposes, though, that is an option that can be toggled with the function's second parameter.

Parameters

Name Description Value Type Default Value
shadowRoot

The shadow root of the target custom element.

ShadowRoot
undefined
addNewlines?

Optional

Determines whether to add newlines to the exportparts value or not.

boolean
false
config?

Optional

A PartExportPartMap object that maps part values to exportparts assignment.

PartExportPartMap
undefined

getExportPartsFromParts

Return Type
string

*Note: This is the function that provides the main processing for the assignPartsAsExportPartsAttribute() function. It's not necesarry to use this function in order to assign exportparts values.

For each element in the shadow root used as the function's first parameter, the function collects the element's part attribute values and adds them to a cumulative string value that can be assigned to an element.

By default, the function will not add newlines to the return value. For debugging purposes, though, that is an option that can be toggled with the function's second parameter.

Parameters

Name Description Value Type Default Value
shadowRoot

The shadow root of the target custom element.

ShadowRoot
undefined
addNewlines?

Optional

Determines whether to add newlines to the return value or not.

boolean
false
config?

Optional

A PartExportPartMap object that maps part values to exportparts assignment.

PartExportPartMap
undefined