MCPcopy
hub / github.com/lit/lit / AttributePart

Class AttributePart

packages/lit-html/src/lit-html.ts:1801–1960  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1799
1800export type {AttributePart};
1801class AttributePart implements Disconnectable {
1802 readonly type:
1803 | typeof ATTRIBUTE_PART
1804 | typeof PROPERTY_PART
1805 | typeof BOOLEAN_ATTRIBUTE_PART
1806 | typeof EVENT_PART = ATTRIBUTE_PART;
1807 readonly element: HTMLElement;
1808 readonly name: string;
1809 readonly options: RenderOptions | undefined;
1810
1811 /**
1812 * If this attribute part represents an interpolation, this contains the
1813 * static strings of the interpolation. For single-value, complete bindings,
1814 * this is undefined.
1815 */
1816 readonly strings?: ReadonlyArray<string>;
1817 /** @internal */
1818 _$committedValue: unknown | Array<unknown> = nothing;
1819 /** @internal */
1820 __directives?: Array<Directive | undefined>;
1821 /** @internal */
1822 _$parent: Disconnectable;
1823 /** @internal */
1824 _$disconnectableChildren?: Set<Disconnectable> = undefined;
1825
1826 protected _sanitizer: ValueSanitizer | undefined;
1827
1828 get tagName() {
1829 return this.element.tagName;
1830 }
1831
1832 // See comment in Disconnectable interface for why this is a getter
1833 get _$isConnected() {
1834 return this._$parent._$isConnected;
1835 }
1836
1837 constructor(
1838 element: HTMLElement,
1839 name: string,
1840 strings: ReadonlyArray<string>,
1841 parent: Disconnectable,
1842 options: RenderOptions | undefined
1843 ) {
1844 this.element = element;
1845 this.name = name;
1846 this._$parent = parent;
1847 this.options = options;
1848 if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {
1849 this._$committedValue = new Array(strings.length - 1).fill(new String());
1850 this.strings = strings;
1851 } else {
1852 this._$committedValue = nothing;
1853 }
1854 if (ENABLE_EXTRA_SECURITY_HOOKS) {
1855 this._sanitizer = undefined;
1856 }
1857 }
1858

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…