Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensuring we don't affect underlying page when handling noscript #547

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions packages/clarity-js/src/layout/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function (node: Node, source: Source): Node {
// Also, we do not track text nodes for STYLE tags
// The only exception is when we receive a mutation to remove the text node, in that case
// parent will be null, but we can still process the node by checking it's an update call.
if (call === "update" || (parent && dom.has(parent) && parent.tagName !== "STYLE")) {
if (call === "update" || (parent && dom.has(parent) && parent.tagName !== "STYLE" && parent.tagName !== "NOSCRIPT")) {
let textData = { tag: Constant.TextTag, value: node.nodeValue };
dom[call](node, parent, textData, source);
}
Expand Down Expand Up @@ -108,10 +108,9 @@ export default function (node: Node, source: Source): Node {
}
break;
case "NOSCRIPT":
// keeping the noscript tag but removing all of its contents. Some HTML markup relies on having these tags
// keeping the noscript tag but ignoring its contents. Some HTML markup relies on having these tags
// to maintain parity with the original css view, but we don't want to execute any noscript in Clarity
element.innerHTML = '';
let noscriptData = { tag, attributes: {} };
let noscriptData = { tag, attributes: {}, value: '' };
dom[call](node, parent, noscriptData, source);
break;
case "META":
Expand Down
Loading