浏览代码

Work around bug where doc list is active but its el has no parent

No idea what's going on :/

TypeError: Cannot read property 'removeChild' of null
  at HTMLDivElement.<anonymous>()
  at o.app.views.ListFold.o.onClick()
  at o.app.views.ListFold.o.toggle()
  at o.app.views.ListFold.o.close()
  at Function.$.trigger()
  at HTMLDivElement.<anonymous>()
  at o.app.views.DocList.o.onClose()
  at o.app.View.e.detach()
  at Function.$.remove()
Thibaut Courouble 9 年之前
父节点
当前提交
f0ed6af794
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      assets/javascripts/lib/util.coffee

+ 2 - 2
assets/javascripts/lib/util.coffee

@@ -111,9 +111,9 @@ $.after = (el, value) ->
 
 $.remove = (value) ->
   if $.isCollection(value)
-    el.parentElement.removeChild(el) for el in $.makeArray(value)
+    el.parentElement?.removeChild(el) for el in $.makeArray(value)
   else
-    value.parentElement.removeChild(value)
+    value.parentElement?.removeChild(value)
   return
 
 $.empty = (el) ->