MCPcopy
hub / github.com/vuejs/core / remove

Function remove

packages/runtime-test/src/nodeOps.ts:173–193  ·  view source on GitHub ↗
(child: TestNode, logOp = true)

Source from the content-addressed store, hash-verified

171}
172
173function remove(child: TestNode, logOp = true): void {
174 const parent = child.parentNode
175 if (parent) {
176 if (logOp) {
177 logNodeOp({
178 type: NodeOpTypes.REMOVE,
179 targetNode: child,
180 parentNode: parent,
181 })
182 }
183 const i = parent.children.indexOf(child)
184 if (i > -1) {
185 parent.children.splice(i, 1)
186 } else {
187 console.error('target: ', child)
188 console.error('parent: ', parent)
189 throw Error('target is not a childNode of parent')
190 }
191 child.parentNode = null
192 }
193}
194
195function setElementText(el: TestElement, text: string): void {
196 logNodeOp({

Callers 1

insertFunction · 0.70

Calls 3

logNodeOpFunction · 0.85
indexOfMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected