mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
Clear dataset elements for pooled objects
This commit is contained in:
parent
ad83a03440
commit
f8868ffcf2
@ -9,12 +9,14 @@ class DOMElementPool
|
||||
for tagName, freeElements of @freeElementsByTagName
|
||||
freeElements.length = 0
|
||||
|
||||
build: (tagName, className, textContent) ->
|
||||
build: (tagName, className, textContent = "") ->
|
||||
element = @freeElementsByTagName[tagName]?.pop()
|
||||
element ?= document.createElement(tagName)
|
||||
element.className = className
|
||||
element.textContent = textContent
|
||||
delete element.dataset[dataId] for dataId of element.dataset
|
||||
element.removeAttribute("class")
|
||||
element.removeAttribute("style")
|
||||
element.className = className if className?
|
||||
element.textContent = textContent
|
||||
|
||||
@freedElements.delete(element)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user