diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 27835f28c..690c1005d 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -575,12 +575,7 @@ })(); $.rmAll = function(root) { - var node, _i, _len, _ref; - _ref = __slice.call(root.childNodes); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - node = _ref[_i]; - root.removeChild(node); - } + return root.textContent = ''; }; $.tn = function(s) { @@ -12156,13 +12151,11 @@ } }, clean: function() { - var board; g.threads.forEach(function(thread) { return thread.collect(); }); QuoteBacklink.containers = {}; - board = $('.board'); - return $.replace(board, board.cloneNode(false)); + return $.rmAll($('.board')); }, features: [['Thread Excerpt', ThreadExcerpt], ['Unread Count', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Expansion', ExpandThread]], disconnect: function() { diff --git a/builds/crx/script.js b/builds/crx/script.js index 3fd4559a2..5a949b0c4 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -552,12 +552,7 @@ })(); $.rmAll = function(root) { - var node, _i, _len, _ref; - _ref = __slice.call(root.childNodes); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - node = _ref[_i]; - root.removeChild(node); - } + return root.textContent = ''; }; $.tn = function(s) { @@ -12155,13 +12150,11 @@ } }, clean: function() { - var board; g.threads.forEach(function(thread) { return thread.collect(); }); QuoteBacklink.containers = {}; - board = $('.board'); - return $.replace(board, board.cloneNode(false)); + return $.rmAll($('.board')); }, features: [['Thread Excerpt', ThreadExcerpt], ['Unread Count', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Expansion', ExpandThread]], disconnect: function() { diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index d37f664df..9795831a0 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -37,8 +37,7 @@ Navigate = g.threads.forEach (thread) -> thread.collect() QuoteBacklink.containers = {} - board = $('.board') - $.replace board, board.cloneNode false + $.rmAll $('.board') features: [ ['Thread Excerpt', ThreadExcerpt] diff --git a/src/General/lib/$.coffee b/src/General/lib/$.coffee index 48467ef33..c33f2271c 100755 --- a/src/General/lib/$.coffee +++ b/src/General/lib/$.coffee @@ -133,12 +133,8 @@ $.rm = do -> else (el) -> el.parentNode?.removeChild el -$.rmAll = (root) -> - # jsperf.com/emptify-element - for node in [root.childNodes...] - # HTMLSelectElement.remove !== Element.remove - root.removeChild node - return +# jsperf.com/emptify-element/9 +$.rmAll = (root) -> root.textContent = '' $.tn = (s) -> d.createTextNode s