@@ -164,26 +164,28 @@ export class FocusTrap {
164
164
*/
165
165
private _getRegionBoundary ( bound : 'start' | 'end' ) : HTMLElement | null {
166
166
// Contains the deprecated version of selector, for temporary backwards comparability.
167
- let markers = this . _element . querySelectorAll (
167
+ const markers = this . _element . querySelectorAll (
168
168
`[cdk-focus-region-${ bound } ], ` + `[cdkFocusRegion${ bound } ], ` + `[cdk-focus-${ bound } ]` ,
169
169
) as NodeListOf < HTMLElement > ;
170
170
171
- for ( let i = 0 ; i < markers . length ; i ++ ) {
172
- // @breaking -change 8.0.0
173
- if ( markers [ i ] . hasAttribute ( `cdk-focus-${ bound } ` ) ) {
174
- console . warn (
175
- `Found use of deprecated attribute 'cdk-focus-${ bound } ', ` +
176
- `use 'cdkFocusRegion${ bound } ' instead. The deprecated ` +
177
- `attribute will be removed in 8.0.0.` ,
178
- markers [ i ] ,
179
- ) ;
180
- } else if ( markers [ i ] . hasAttribute ( `cdk-focus-region-${ bound } ` ) ) {
181
- console . warn (
182
- `Found use of deprecated attribute 'cdk-focus-region-${ bound } ', ` +
183
- `use 'cdkFocusRegion${ bound } ' instead. The deprecated attribute ` +
184
- `will be removed in 8.0.0.` ,
185
- markers [ i ] ,
186
- ) ;
171
+ if ( typeof ngDevMode === 'undefined' || ngDevMode ) {
172
+ for ( let i = 0 ; i < markers . length ; i ++ ) {
173
+ // @breaking -change 8.0.0
174
+ if ( markers [ i ] . hasAttribute ( `cdk-focus-${ bound } ` ) ) {
175
+ console . warn (
176
+ `Found use of deprecated attribute 'cdk-focus-${ bound } ', ` +
177
+ `use 'cdkFocusRegion${ bound } ' instead. The deprecated ` +
178
+ `attribute will be removed in 8.0.0.` ,
179
+ markers [ i ] ,
180
+ ) ;
181
+ } else if ( markers [ i ] . hasAttribute ( `cdk-focus-region-${ bound } ` ) ) {
182
+ console . warn (
183
+ `Found use of deprecated attribute 'cdk-focus-region-${ bound } ', ` +
184
+ `use 'cdkFocusRegion${ bound } ' instead. The deprecated attribute ` +
185
+ `will be removed in 8.0.0.` ,
186
+ markers [ i ] ,
187
+ ) ;
188
+ }
187
189
}
188
190
}
189
191
@@ -207,7 +209,10 @@ export class FocusTrap {
207
209
208
210
if ( redirectToElement ) {
209
211
// @breaking -change 8.0.0
210
- if ( redirectToElement . hasAttribute ( `cdk-focus-initial` ) ) {
212
+ if (
213
+ ( typeof ngDevMode === 'undefined' || ngDevMode ) &&
214
+ redirectToElement . hasAttribute ( `cdk-focus-initial` )
215
+ ) {
211
216
console . warn (
212
217
`Found use of deprecated attribute 'cdk-focus-initial', ` +
213
218
`use 'cdkFocusInitial' instead. The deprecated attribute ` +
0 commit comments