It is now safe to use Node::remove.

This commit is contained in:
Mayhem 2014-01-26 21:25:18 +01:00
parent 24f93da8e7
commit 06e5ce4ef6

View File

@ -99,16 +99,12 @@ $.rmClass = (el, className...) ->
el.classList.remove className...
$.hasClass = (el, className) ->
el.classList.contains className
$.rm = do ->
if 'remove' of Element.prototype
(el) -> el.remove()
else
(el) -> el.parentNode?.removeChild el
$.rm = (el) ->
el.remove()
$.rmAll = (root) ->
# jsperf.com/emptify-element
for node in [root.childNodes...]
# HTMLSelectElement.remove !== Element.remove
root.removeChild node
node.remove()
return
$.tn = (s) ->
d.createTextNode s