Element.AttachShadow

Element.AttachShadow method

Creates shadow root and attaches it to current element.

public ShadowRoot AttachShadow(ShadowRootMode mode)
ParameterTypeDescription
modeShadowRootModeMode in which shadow root will be created.

Return Value

Created ShadowRoot.

Exceptions

exceptioncondition
ErrorNotSupportedError: Element does not support shadow tree.
ErrorInvalidStateError: Element already has shadow tree.

See Also