mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Merge pull request #14893 from atom/as-fix-resetting-node-pool-styles
Fix resetting styles in NodePool
This commit is contained in:
@@ -4040,7 +4040,6 @@ class NodePool {
|
||||
constructor () {
|
||||
this.elementsByType = {}
|
||||
this.textNodes = []
|
||||
this.stylesByNode = new WeakMap()
|
||||
}
|
||||
|
||||
getElement (type, className, style) {
|
||||
@@ -4061,14 +4060,10 @@ class NodePool {
|
||||
|
||||
if (element) {
|
||||
element.className = className
|
||||
var existingStyle = this.stylesByNode.get(element)
|
||||
if (existingStyle) {
|
||||
for (var key in existingStyle) {
|
||||
if (!style || !style[key]) element.style[key] = ''
|
||||
}
|
||||
}
|
||||
element.styleMap.forEach((value, key) => {
|
||||
if (!style || style[key] == null) element.style[key] = ''
|
||||
})
|
||||
if (style) Object.assign(element.style, style)
|
||||
this.stylesByNode.set(element, style)
|
||||
|
||||
while (element.firstChild) element.firstChild.remove()
|
||||
return element
|
||||
@@ -4076,7 +4071,6 @@ class NodePool {
|
||||
var newElement = document.createElement(type)
|
||||
if (className) newElement.className = className
|
||||
if (style) Object.assign(newElement.style, style)
|
||||
this.stylesByNode.set(newElement, style)
|
||||
return newElement
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user