mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
🐎 Save an allocation while removing nodes
This commit is contained in:
parent
6b2e7a6765
commit
536a5f4395
@ -35,7 +35,7 @@ describe "DomElementsPool", ->
|
||||
domElementsPool.freeElementAndDescendants(div)
|
||||
|
||||
expect(domElementsPool.build("div")).toBe(div)
|
||||
expect(domElementsPool.build("span")).toBe(span3)
|
||||
expect(domElementsPool.build("span")).toBe(span4)
|
||||
expect(domElementsPool.build("span")).toBe(span1)
|
||||
expect(domElementsPool.build("span")).toBe(span2)
|
||||
expect(domElementsPool.build("span")).toBe(span1)
|
||||
expect(domElementsPool.build("span")).toBe(span4)
|
||||
expect(domElementsPool.build("span")).toBe(span3)
|
||||
|
@ -21,5 +21,6 @@ class DomElementsPool
|
||||
freeElementAndDescendants: (element) ->
|
||||
@free(element)
|
||||
|
||||
for child in toArray(element.children)
|
||||
for index in [element.children.length - 1..0] by -1
|
||||
child = element.children[index]
|
||||
@freeElementAndDescendants(child)
|
||||
|
Loading…
Reference in New Issue
Block a user