Use Element.remove() in $.rm when possible.

This commit is contained in:
Nicolas Stepien 2013-04-13 18:01:09 +02:00
parent 5b349905eb
commit 766be903b6
2 changed files with 7 additions and 4 deletions

View File

@ -97,8 +97,11 @@ $.extend $,
el.classList.remove className el.classList.remove className
hasClass: (el, className) -> hasClass: (el, className) ->
el.classList.contains className el.classList.contains className
rm: (el) -> rm: do ->
el.parentNode.removeChild el if 'remove' of Element.prototype
(el) -> el.remove()
else
(el) -> el.parentNode?.removeChild el
tn: (s) -> tn: (s) ->
d.createTextNode s d.createTextNode s
nodes: (nodes) -> nodes: (nodes) ->

View File

@ -225,7 +225,7 @@ class Notification
setTimeout @close, @timeout * $.SECOND if @timeout setTimeout @close, @timeout * $.SECOND if @timeout
close = -> close = ->
$.rm @el if @el.parentNode $.rm @el
Settings = Settings =
init: -> init: ->
@ -3798,7 +3798,7 @@ Unread =
{root} = post.nodes {root} = post.nodes
if root isnt $ '.thread > .replyContainer', root.parentNode # not the first reply if root isnt $ '.thread > .replyContainer', root.parentNode # not the first reply
$.before root, Unread.hr $.before root, Unread.hr
else if Unread.hr.parentNode else
$.rm Unread.hr $.rm Unread.hr
update: <% if (type === 'crx') { %>(dontrepeat) <% } %>-> update: <% if (type === 'crx') { %>(dontrepeat) <% } %>->