From d46c20931ef87dde0d4f6407871e9be4c3fd7983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= <69278826+cetincakiroglu@users.noreply.github.com> Date: Thu, 15 Aug 2024 15:08:33 +0300 Subject: [PATCH] Fixes #16211 --- src/app/components/table/table.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/components/table/table.ts b/src/app/components/table/table.ts index c5fba8770c2..2f23b5f15ca 100644 --- a/src/app/components/table/table.ts +++ b/src/app/components/table/table.ts @@ -77,6 +77,7 @@ import { TableRowUnSelectEvent, TableSelectAllChangeEvent } from './table.interface'; +import { DomSanitizer } from '@angular/platform-browser'; @Injectable() export class TableService { @@ -1175,7 +1176,8 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable public cd: ChangeDetectorRef, public filterService: FilterService, public overlayService: OverlayService, - public config: PrimeNGConfig + public config: PrimeNGConfig, + private readonly domSanitizer: DomSanitizer ) { this.window = this.document.defaultView as Window; } @@ -2689,7 +2691,7 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable } `; }); - this.renderer.setProperty(this.styleElement, 'textContent', innerHTML); + this.renderer.setProperty(this.styleElement, 'innerHTML', this.domSanitizer.bypassSecurityTrustStyle(innerHTML)); } onRowDragStart(event: any, index: number) { @@ -3040,7 +3042,7 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable } } `; - this.renderer.setProperty(this.responsiveStyleElement, 'textContent', innerHTML); + this.renderer.setProperty(this.responsiveStyleElement, 'innerHTML', this.domSanitizer.bypassSecurityTrustStyle(innerHTML)); } } }