MCPcopy Create free account
hub / github.com/adobe/react-spectrum / removeChild

Method removeChild

packages/react-aria/src/collections/Document.ts:187–222  ·  view source on GitHub ↗
(child: ElementNode<T>)

Source from the content-addressed store, hash-verified

185 }
186
187 removeChild(child: ElementNode<T>): void {
188 if (child.parentNode !== this) {
189 return;
190 }
191
192 if (this._minInvalidChildIndex === child) {
193 this._minInvalidChildIndex = null;
194 }
195
196 if (child.nextSibling) {
197 this.invalidateChildIndices(child.nextSibling);
198 child.nextSibling.previousSibling = child.previousSibling;
199 }
200
201 if (child.previousSibling) {
202 child.previousSibling.nextSibling = child.nextSibling;
203 }
204
205 if (this.firstChild === child) {
206 this.firstChild = child.nextSibling;
207 }
208
209 if (this.lastChild === child) {
210 this.lastChild = child.previousSibling;
211 }
212
213 child.parentNode = null;
214 child.nextSibling = null;
215 child.previousSibling = null;
216 child.index = 0;
217
218 this.ownerDocument.markDirty(child);
219 if (this.isConnected) {
220 this.ownerDocument.queueUpdate();
221 }
222 }
223
224 addEventListener(): void {}
225 removeEventListener(): void {}

Callers 3

appendChildMethod · 0.45
insertBeforeMethod · 0.45
Hidden.tsxFile · 0.45

Calls 3

markDirtyMethod · 0.80
queueUpdateMethod · 0.80

Tested by

no test coverage detected