It is now safe to use Node::remove.
This commit is contained in:
parent
24f93da8e7
commit
06e5ce4ef6
10
lib/$.coffee
10
lib/$.coffee
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user