From 766be903b62b255c61b57920ebe2b56be8a2a6d4 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 13 Apr 2013 18:01:09 +0200 Subject: [PATCH] Use Element.remove() in $.rm when possible. --- lib/$.coffee | 7 +++++-- src/features.coffee | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/$.coffee b/lib/$.coffee index 4b2e3d293..5de9784a0 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -97,8 +97,11 @@ $.extend $, el.classList.remove className hasClass: (el, className) -> el.classList.contains className - rm: (el) -> - el.parentNode.removeChild el + rm: do -> + if 'remove' of Element.prototype + (el) -> el.remove() + else + (el) -> el.parentNode?.removeChild el tn: (s) -> d.createTextNode s nodes: (nodes) -> diff --git a/src/features.coffee b/src/features.coffee index abd63d5cf..b077b01f2 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -225,7 +225,7 @@ class Notification setTimeout @close, @timeout * $.SECOND if @timeout close = -> - $.rm @el if @el.parentNode + $.rm @el Settings = init: -> @@ -3798,7 +3798,7 @@ Unread = {root} = post.nodes if root isnt $ '.thread > .replyContainer', root.parentNode # not the first reply $.before root, Unread.hr - else if Unread.hr.parentNode + else $.rm Unread.hr update: <% if (type === 'crx') { %>(dontrepeat) <% } %>->