From dcace7e1a031c0cd48823e033dab3883d8ad0cd2 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Fri, 23 Aug 2024 14:02:09 +0200 Subject: [PATCH] fix(cdk/drag-drop): error if ngDevMode is undefined Fixes that the drag&drop module wasn't checking for `ngDevMode` correctly. Fixes #29633. --- src/cdk/drag-drop/drag-ref.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cdk/drag-drop/drag-ref.ts b/src/cdk/drag-drop/drag-ref.ts index 3d79211636d4..a8c138a05d37 100644 --- a/src/cdk/drag-drop/drag-ref.ts +++ b/src/cdk/drag-drop/drag-ref.ts @@ -829,7 +829,10 @@ export class DragRef { const parent = element.parentNode as HTMLElement; const placeholder = (this._placeholder = this._createPlaceholderElement()); const anchor = (this._anchor = - this._anchor || this._document.createComment(ngDevMode ? 'cdk-drag-anchor' : '')); + this._anchor || + this._document.createComment( + typeof ngDevMode === 'undefined' || ngDevMode ? 'cdk-drag-anchor' : '', + )); // Insert an anchor node so that we can restore the element's position in the DOM. parent.insertBefore(anchor, element);