Make the tweet a single child in the parent class=tweet element even there are more than one twitter links in it

This commit is contained in:
Hongbo Wu
2022-06-13 17:36:15 +08:00
parent 64673bd6db
commit ff87371d21

View File

@ -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;