Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit f1bd2b8

Browse files
committed
Merge remote-tracking branch 'origin/develop' into justjanne/feat/onboarding-page
2 parents 8406cf1 + e28fd86 commit f1bd2b8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/utils/tooltipify.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ export function tooltipifyLinks(rootNodes: ArrayLike<Element>, ignoredNodes: Ele
5353
const href = node.getAttribute("href");
5454

5555
const tooltip = <LinkWithTooltip tooltip={new URL(href, window.location.href).toString()}>
56-
<span dangerouslySetInnerHTML={{ __html: node.outerHTML }} />
56+
{ node.innerHTML }
5757
</LinkWithTooltip>;
5858

5959
ReactDOM.render(tooltip, container);
60-
node.parentNode.replaceChild(container, node);
60+
node.replaceChildren(container);
6161
containers.push(container);
6262
tooltipified = true;
6363
}

test/utils/tooltipify-test.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ describe('tooltipify', () => {
4141
const containers: Element[] = [];
4242
tooltipifyLinks([root], [], containers);
4343
expect(containers).toHaveLength(1);
44-
const anchor = root.querySelector(".mx_TextWithTooltip_target a");
44+
const anchor = root.querySelector("a");
4545
expect(anchor?.getAttribute("href")).toEqual("/foo");
46-
expect(anchor?.innerHTML).toEqual("click");
46+
const tooltip = anchor.querySelector(".mx_TextWithTooltip_target");
47+
expect(tooltip).toBeDefined();
4748
});
4849

4950
it('ignores node', () => {

0 commit comments

Comments
 (0)