MCPcopy
hub / github.com/postcss/postcss / insertAfter

Method insertAfter

lib/container.js:144–161  ·  view source on GitHub ↗
(exist, add)

Source from the content-addressed store, hash-verified

142 }
143
144 insertAfter(exist, add) {
145 let existIndex = this.index(exist)
146 let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse()
147 existIndex = this.index(exist)
148 for (let node of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node)
149
150 let index
151 for (let id in this.indexes) {
152 index = this.indexes[id]
153 if (existIndex < index) {
154 this.indexes[id] = index + nodes.length
155 }
156 }
157
158 this.markDirty()
159
160 return this
161 }
162
163 insertBefore(exist, add) {
164 let existIndex = this.index(exist)

Callers 5

afterMethod · 0.80
cloneAfterMethod · 0.80
replaceWithMethod · 0.80
root.test.tsFile · 0.80
container.test.tsFile · 0.80

Calls 3

indexMethod · 0.95
normalizeMethod · 0.95
markDirtyMethod · 0.80

Tested by

no test coverage detected