From ff87371d21f3bb2eaaab0e230b953e8e41d31c03 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Mon, 13 Jun 2022 17:36:15 +0800 Subject: [PATCH] Make the tweet a single child in the parent class=tweet element even there are more than one twitter links in it --- packages/readabilityjs/Readability.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/readabilityjs/Readability.js b/packages/readabilityjs/Readability.js index c4cf75afb..3d2a2931d 100644 --- a/packages/readabilityjs/Readability.js +++ b/packages/readabilityjs/Readability.js @@ -2209,7 +2209,7 @@ Readability.prototype = { for (const element of Array.from(e.getElementsByTagName('a'))) { if (this.isEmbed(element)) { - continue; + return; } // Create tweets placeholders from links @@ -2223,7 +2223,7 @@ Readability.prototype = { tweet.innerText = 'Tweet placeholder'; tweet.className = 'tweet-placeholder'; tweet.setAttribute('data-tweet-id', match[2]); - element.parentNode.replaceChild(tweet, element); + element.parentNode.replaceChildren(tweet); // remove all containers the tweet is nested in (if they contain the tweet only) let tweetParent = tweet.parentElement || tweet.parentNode;