From 900daa3e566ced72cf4416e5421b94a2238e2e6d Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 2 Aug 2015 01:37:39 -0700 Subject: [PATCH] Work around Edge issues with HTMLCollections. --- src/General/lib/clone.class | 10 +++++++++- src/General/lib/post.class | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/General/lib/clone.class b/src/General/lib/clone.class index 918a4a505..63133189c 100755 --- a/src/General/lib/clone.class +++ b/src/General/lib/clone.class @@ -19,7 +19,15 @@ class Clone extends Post quote: $ '.postNum > a:nth-of-type(2)', info comment: $ '.postMessage', post quotelinks: [] - backlinks: info.getElementsByClassName 'backlink' + + # XXX Edge invalidates HTMLCollections when an ancestor node is inserted into another node. + if $.engine is 'edge' + Object.defineProperty @nodes, 'backlinks', + configurable: true + enumerable: true + get: -> info.getElementsByClassName 'backlink' + else + @nodes.backlinks = info.getElementsByClassName 'backlink' # Remove inlined posts inside of this post. for inline in $$ '.inline', post diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 18fde749f..719dc338a 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -40,7 +40,15 @@ class Post comment: $ '.postMessage', post links: [] quotelinks: [] - backlinks: info.getElementsByClassName 'backlink' + + # XXX Edge invalidates HTMLCollections when an ancestor node is inserted into another node. + if $.engine is 'edge' + Object.defineProperty @nodes, 'backlinks', + configurable: true + enumerable: true + get: -> info.getElementsByClassName 'backlink' + else + @nodes.backlinks = info.getElementsByClassName 'backlink' unless @isReply = $.hasClass post, 'reply' @thread.OP = @