Skip to content

Commit

Permalink
Remove <noscript> elements to fix Twitter snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
AbeJellinek committed Sep 15, 2023
1 parent c13fd93 commit df7862f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/dom/snapshot/snapshot-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ class SnapshotView extends DOMView<SnapshotViewState, SnapshotViewData> {
cspMeta.setAttribute('content', this._getCSP());
doc.head.prepend(cspMeta);

// Fix Twitter snapshots breaking because of <noscript> styles
for (let noscript of Array.from(doc.querySelectorAll('noscript'))) {
noscript.remove();
}

return new XMLSerializer().serializeToString(doc);
}
else {
Expand Down

0 comments on commit df7862f

Please sign in to comment.