diff --git a/src/app/components/calendar/calendar.ts b/src/app/components/calendar/calendar.ts index 4fd23823147..4f6ada6b797 100644 --- a/src/app/components/calendar/calendar.ts +++ b/src/app/components/calendar/calendar.ts @@ -1169,15 +1169,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor { return this.currentView === 'year' ? this.getTranslation('nextDecade') : this.currentView === 'month' ? this.getTranslation('nextYear') : this.getTranslation('nextMonth'); } - constructor( - @Inject(DOCUMENT) private document: Document, - public el: ElementRef, - public renderer: Renderer2, - public cd: ChangeDetectorRef, - private zone: NgZone, - private config: PrimeNGConfig, - public overlayService: OverlayService - ) { + constructor(@Inject(DOCUMENT) private document: Document, public el: ElementRef, public renderer: Renderer2, public cd: ChangeDetectorRef, private zone: NgZone, private config: PrimeNGConfig, public overlayService: OverlayService) { this.window = this.document.defaultView as Window; } @@ -3544,6 +3536,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor { if (!this.responsiveStyleElement) { this.responsiveStyleElement = this.renderer.createElement('style'); (this.responsiveStyleElement).type = 'text/css'; + DomHandler.setAttribute(this.responsiveStyleElement, 'nonce', this.config?.csp()?.nonce); this.renderer.appendChild(this.document.body, this.responsiveStyleElement); } @@ -3576,7 +3569,6 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor { } (this.responsiveStyleElement).innerHTML = innerHTML; - DomHandler.setAttribute(this.responsiveStyleElement, 'nonce', this.config?.csp()?.nonce); } } diff --git a/src/app/components/carousel/carousel.ts b/src/app/components/carousel/carousel.ts index bf4277a2956..1409301165e 100755 --- a/src/app/components/carousel/carousel.ts +++ b/src/app/components/carousel/carousel.ts @@ -357,15 +357,7 @@ export class Carousel implements AfterContentInit { window: Window; - constructor( - public el: ElementRef, - public zone: NgZone, - public cd: ChangeDetectorRef, - private renderer: Renderer2, - @Inject(DOCUMENT) private document: Document, - @Inject(PLATFORM_ID) private platformId: any, - private config: PrimeNGConfig - ) { + constructor(public el: ElementRef, public zone: NgZone, public cd: ChangeDetectorRef, private renderer: Renderer2, @Inject(DOCUMENT) private document: Document, @Inject(PLATFORM_ID) private platformId: any, private config: PrimeNGConfig) { this.totalShiftedItems = this.page * this.numScroll * -1; this.window = this.document.defaultView as Window; } diff --git a/src/app/components/confirmdialog/confirmdialog.ts b/src/app/components/confirmdialog/confirmdialog.ts index fcc7d0ca729..666aa4f344d 100755 --- a/src/app/components/confirmdialog/confirmdialog.ts +++ b/src/app/components/confirmdialog/confirmdialog.ts @@ -442,15 +442,7 @@ export class ConfirmDialog implements AfterContentInit, OnInit, OnDestroy { translationSubscription: Subscription | undefined; - constructor( - public el: ElementRef, - public renderer: Renderer2, - private confirmationService: ConfirmationService, - public zone: NgZone, - private cd: ChangeDetectorRef, - public config: PrimeNGConfig, - @Inject(DOCUMENT) private document: Document - ) { + constructor(public el: ElementRef, public renderer: Renderer2, private confirmationService: ConfirmationService, public zone: NgZone, private cd: ChangeDetectorRef, public config: PrimeNGConfig, @Inject(DOCUMENT) private document: Document) { this.subscription = this.confirmationService.requireConfirmation$.subscribe((confirmation) => { if (!confirmation) { this.hide(); @@ -611,6 +603,7 @@ export class ConfirmDialog implements AfterContentInit, OnInit, OnDestroy { if (!this.styleElement) { this.styleElement = this.document.createElement('style'); this.styleElement.type = 'text/css'; + DomHandler.setAttribute(this.styleElement, 'nonce', this.config?.csp()?.nonce); this.document.head.appendChild(this.styleElement); let innerHTML = ''; for (let breakpoint in this.breakpoints) { @@ -624,7 +617,6 @@ export class ConfirmDialog implements AfterContentInit, OnInit, OnDestroy { } this.styleElement.innerHTML = innerHTML; - DomHandler.setAttribute(this.styleElement, 'nonce', this.config?.csp()?.nonce); } } diff --git a/src/app/components/dialog/dialog.ts b/src/app/components/dialog/dialog.ts index 1d9b7faa391..93918923200 100755 --- a/src/app/components/dialog/dialog.ts +++ b/src/app/components/dialog/dialog.ts @@ -546,15 +546,7 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy { return this.config.getTranslation(TranslationKeys.ARIA)['maximizeLabel']; } - constructor( - @Inject(DOCUMENT) private document: Document, - @Inject(PLATFORM_ID) private platformId: any, - public el: ElementRef, - public renderer: Renderer2, - public zone: NgZone, - private cd: ChangeDetectorRef, - public config: PrimeNGConfig - ) { + constructor(@Inject(DOCUMENT) private document: Document, @Inject(PLATFORM_ID) private platformId: any, public el: ElementRef, public renderer: Renderer2, public zone: NgZone, private cd: ChangeDetectorRef, public config: PrimeNGConfig) { this.window = this.document.defaultView as Window; } @@ -696,6 +688,7 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy { if (!this.styleElement) { this.styleElement = this.renderer.createElement('style'); this.styleElement.type = 'text/css'; + DomHandler.setAttribute(this.styleElement, 'nonce', this.config?.csp()?.nonce); this.renderer.appendChild(this.document.head, this.styleElement); let innerHTML = ''; for (let breakpoint in this.breakpoints) { @@ -709,7 +702,6 @@ export class Dialog implements AfterContentInit, OnInit, OnDestroy { } this.renderer.setProperty(this.styleElement, 'innerHTML', innerHTML); - DomHandler.setAttribute(this.styleElement, 'nonce', this.config?.csp()?.nonce); } } } diff --git a/src/app/components/orderlist/orderlist.ts b/src/app/components/orderlist/orderlist.ts index 5203599717b..c64e240a584 100755 --- a/src/app/components/orderlist/orderlist.ts +++ b/src/app/components/orderlist/orderlist.ts @@ -913,6 +913,7 @@ export class OrderList implements AfterViewChecked, AfterContentInit { this.renderer.setAttribute(this.el.nativeElement.children[0], this.id, ''); this.styleElement = this.renderer.createElement('style'); this.renderer.setAttribute(this.styleElement, 'type', 'text/css'); + DomHandler.setAttribute(this.styleElement, 'nonce', this.config?.csp()?.nonce); this.renderer.appendChild(this.document.head, this.styleElement); let innerHTML = ` @@ -937,7 +938,6 @@ export class OrderList implements AfterViewChecked, AfterContentInit { } `; this.renderer.setProperty(this.styleElement, 'innerHTML', innerHTML); - DomHandler.setAttribute(this.styleElement, 'nonce', this.config?.csp()?.nonce); } } } diff --git a/src/app/components/picklist/picklist.ts b/src/app/components/picklist/picklist.ts index 71c7b5c89cd..ffb70b44f80 100755 --- a/src/app/components/picklist/picklist.ts +++ b/src/app/components/picklist/picklist.ts @@ -1626,6 +1626,7 @@ export class PickList implements AfterViewChecked, AfterContentInit { this.renderer.setAttribute(this.el.nativeElement.children[0], this.id, ''); this.styleElement = this.renderer.createElement('style'); this.renderer.setAttribute(this.styleElement, 'type', 'text/css'); + DomHandler.setAttribute(this.styleElement, 'nonce', this.config?.csp()?.nonce); this.renderer.appendChild(this.document.head, this.styleElement); let innerHTML = ` @@ -1650,7 +1651,6 @@ export class PickList implements AfterViewChecked, AfterContentInit { }`; this.renderer.setProperty(this.styleElement, 'innerHTML', innerHTML); - DomHandler.setAttribute(this.styleElement, 'nonce', this.config?.csp()?.nonce); } } } diff --git a/src/app/components/table/table.ts b/src/app/components/table/table.ts index e666784d50f..0a282032d2a 100644 --- a/src/app/components/table/table.ts +++ b/src/app/components/table/table.ts @@ -2974,8 +2974,8 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable createStyleElement() { this.styleElement = this.renderer.createElement('style'); this.styleElement.type = 'text/css'; - this.renderer.appendChild(this.document.head, this.styleElement); DomHandler.setAttribute(this.styleElement, 'nonce', this.config?.csp()?.nonce); + this.renderer.appendChild(this.document.head, this.styleElement); } getGroupRowsMeta() { @@ -2987,8 +2987,8 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable if (!this.responsiveStyleElement) { this.responsiveStyleElement = this.renderer.createElement('style'); this.responsiveStyleElement.type = 'text/css'; - this.renderer.appendChild(this.document.head, this.responsiveStyleElement); DomHandler.setAttribute(this.responsiveStyleElement, 'nonce', this.config?.csp()?.nonce); + this.renderer.appendChild(this.document.head, this.responsiveStyleElement); let innerHTML = ` @media screen and (max-width: ${this.breakpoint}) { diff --git a/src/app/components/toast/toast.ts b/src/app/components/toast/toast.ts index 20a07b446b0..3a3a94448db 100755 --- a/src/app/components/toast/toast.ts +++ b/src/app/components/toast/toast.ts @@ -150,10 +150,7 @@ export class ToastItem implements AfterViewInit, OnDestroy { timeout: any; - constructor( - private zone: NgZone, - private config: PrimeNGConfig - ) {} + constructor(private zone: NgZone, private config: PrimeNGConfig) {} ngAfterViewInit() { this.initTimeout(); @@ -162,15 +159,12 @@ export class ToastItem implements AfterViewInit, OnDestroy { initTimeout() { if (!this.message?.sticky) { this.zone.runOutsideAngular(() => { - this.timeout = setTimeout( - () => { - this.onClose.emit({ - index: this.index, - message: this.message - }); - }, - this.message?.life || this.life || 3000 - ); + this.timeout = setTimeout(() => { + this.onClose.emit({ + index: this.index, + message: this.message + }); + }, this.message?.life || this.life || 3000); }); } } @@ -349,13 +343,7 @@ export class Toast implements OnInit, AfterContentInit, OnDestroy { _position: ToastPositionType = 'top-right'; - constructor( - @Inject(DOCUMENT) private document: Document, - private renderer: Renderer2, - public messageService: MessageService, - private cd: ChangeDetectorRef, - public config: PrimeNGConfig - ) {} + constructor(@Inject(DOCUMENT) private document: Document, private renderer: Renderer2, public messageService: MessageService, private cd: ChangeDetectorRef, public config: PrimeNGConfig) {} styleElement: any; @@ -476,6 +464,7 @@ export class Toast implements OnInit, AfterContentInit, OnDestroy { if (!this.styleElement) { this.styleElement = this.renderer.createElement('style'); this.styleElement.type = 'text/css'; + DomHandler.setAttribute(this.styleElement, 'nonce', this.config?.csp()?.nonce); this.renderer.appendChild(this.document.head, this.styleElement); let innerHTML = ''; for (let breakpoint in this.breakpoints) { @@ -493,7 +482,6 @@ export class Toast implements OnInit, AfterContentInit, OnDestroy { } this.renderer.setProperty(this.styleElement, 'innerHTML', innerHTML); - DomHandler.setAttribute(this.styleElement, 'nonce', this.config?.csp()?.nonce); } }