mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Slight optimization: Pull reference to @lines[0] in loop into a variable
This commit is contained in:
@@ -202,15 +202,17 @@ class Editor extends View
|
||||
elementsToReplace = @lineCache[startRow...endRow]
|
||||
@lineCache[startRow...endRow] = lineElements?.toArray() or []
|
||||
|
||||
lines = @lines[0]
|
||||
if lineElements
|
||||
fragment = document.createDocumentFragment()
|
||||
lineElements.each -> fragment.appendChild(this)
|
||||
if elementToInsertBefore
|
||||
@lines[0].insertBefore(fragment, elementToInsertBefore)
|
||||
lines.insertBefore(fragment, elementToInsertBefore)
|
||||
else
|
||||
@lines[0].appendChild(fragment)
|
||||
lines.appendChild(fragment)
|
||||
|
||||
$(elementsToReplace).remove()
|
||||
elementsToReplace.forEach (element) =>
|
||||
lines.removeChild(element)
|
||||
|
||||
getLineElement: (row) ->
|
||||
@lineCache[row]
|
||||
|
||||
Reference in New Issue
Block a user