We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5421b9a commit e7cfedbCopy full SHA for e7cfedb
.changeset/hot-bats-pull.md
@@ -0,0 +1,5 @@
1
+---
2
+"@chialab/sveltekit-utils": patch
3
4
+
5
+Fix stripHtml method to remove style, script and iframe tags before extracting the text in the html.
packages/utils/src/lib/utils/html.ts
@@ -9,6 +9,7 @@ import { decode } from 'html-entities';
9
export const stripHtml = (html: string | null | undefined): string => {
10
const element = document.createElement('div');
11
element.innerHTML = html ?? '';
12
+ element.querySelectorAll('style,script,iframe').forEach((node) => node.remove());
13
14
return decode(element.innerText);
15
};
0 commit comments