Skip to content

Commit

Permalink
simplify removeScriptTags fct
Browse files Browse the repository at this point in the history
  • Loading branch information
FollowTheFlo committed Oct 19, 2023
1 parent 0589a1d commit d8a190d
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,9 @@ export class OpfCtaScriptsService {
protected removeScriptTags(htmls: string[]) {
return htmls.map((html) => {
const element = new DOMParser().parseFromString(html, 'text/html');
const script = element.getElementsByTagName('script');
for (let i = 0; i < script.length; i++) {
html = html.replace(script[i].outerHTML, '');
}
Array.from(element.getElementsByTagName('script')).forEach((script) => {
html = html.replace(script.outerHTML, '');
});
return html;
});
}
Expand Down

0 comments on commit d8a190d

Please sign in to comment.