@@ -283,22 +283,19 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
283
283
private _ngZone : NgZone ,
284
284
platform : Platform ,
285
285
@Optional ( ) @Inject ( MAT_RIPPLE_GLOBAL_OPTIONS )
286
- globalRippleOptions : RippleGlobalOptions | null ,
287
- // @breaking -change 8.0.0 `animationMode` parameter to become required.
286
+ globalRippleOptions : RippleGlobalOptions | null ,
287
+ private _changeDetectorRef : ChangeDetectorRef ,
288
+ @Inject ( DOCUMENT ) _document : any ,
288
289
@Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) animationMode ?: string ,
289
- // @breaking -change 9.0.0 `_changeDetectorRef` parameter to become required.
290
- private _changeDetectorRef ?: ChangeDetectorRef ,
291
- @Attribute ( 'tabindex' ) tabIndex ?: string ,
292
- // @breaking -change 11.0.0 `_document` parameter to become required.
293
- @Optional ( ) @Inject ( DOCUMENT ) _document ?: any ) {
290
+ @Attribute ( 'tabindex' ) tabIndex ?: string ) {
294
291
super ( _elementRef ) ;
295
292
296
293
this . _addHostClassName ( ) ;
297
294
298
295
// Dynamically create the ripple target, append it within the chip, and use it as the
299
296
// chip's ripple target. Adding the class '.mat-chip-ripple' ensures that it will have
300
297
// the proper styles.
301
- this . _chipRippleTarget = ( _document || document ) . createElement ( 'div' ) ;
298
+ this . _chipRippleTarget = _document . createElement ( 'div' ) ;
302
299
this . _chipRippleTarget . classList . add ( 'mat-chip-ripple' ) ;
303
300
this . _elementRef . nativeElement . appendChild ( this . _chipRippleTarget ) ;
304
301
this . _chipRipple = new RippleRenderer ( this , _ngZone , this . _chipRippleTarget , platform ) ;
@@ -332,7 +329,7 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
332
329
if ( ! this . _selected ) {
333
330
this . _selected = true ;
334
331
this . _dispatchSelectionChange ( ) ;
335
- this . _markForCheck ( ) ;
332
+ this . _changeDetectorRef . markForCheck ( ) ;
336
333
}
337
334
}
338
335
@@ -341,7 +338,7 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
341
338
if ( this . _selected ) {
342
339
this . _selected = false ;
343
340
this . _dispatchSelectionChange ( ) ;
344
- this . _markForCheck ( ) ;
341
+ this . _changeDetectorRef . markForCheck ( ) ;
345
342
}
346
343
}
347
344
@@ -350,15 +347,15 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
350
347
if ( ! this . _selected ) {
351
348
this . _selected = true ;
352
349
this . _dispatchSelectionChange ( true ) ;
353
- this . _markForCheck ( ) ;
350
+ this . _changeDetectorRef . markForCheck ( ) ;
354
351
}
355
352
}
356
353
357
354
/** Toggles the current selected state of this chip. */
358
355
toggleSelected ( isUserInput : boolean = false ) : boolean {
359
356
this . _selected = ! this . selected ;
360
357
this . _dispatchSelectionChange ( isUserInput ) ;
361
- this . _markForCheck ( ) ;
358
+ this . _changeDetectorRef . markForCheck ( ) ;
362
359
return this . selected ;
363
360
}
364
361
@@ -441,13 +438,6 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
441
438
} ) ;
442
439
}
443
440
444
- private _markForCheck ( ) {
445
- // @breaking -change 9.0.0 Remove this method once the _changeDetectorRef is a required param.
446
- if ( this . _changeDetectorRef ) {
447
- this . _changeDetectorRef . markForCheck ( ) ;
448
- }
449
- }
450
-
451
441
static ngAcceptInputType_selected : BooleanInput ;
452
442
static ngAcceptInputType_selectable : BooleanInput ;
453
443
static ngAcceptInputType_removable : BooleanInput ;
@@ -480,11 +470,8 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
480
470
export class MatChipRemove {
481
471
constructor (
482
472
protected _parentChip : MatChip ,
483
- // @breaking -change 11.0.0 `elementRef` parameter to be made required.
484
- elementRef ?: ElementRef < HTMLElement > ) {
485
-
486
- // @breaking -change 11.0.0 Remove null check for `elementRef`.
487
- if ( elementRef && elementRef . nativeElement . nodeName === 'BUTTON' ) {
473
+ elementRef : ElementRef < HTMLElement > ) {
474
+ if ( elementRef . nativeElement . nodeName === 'BUTTON' ) {
488
475
elementRef . nativeElement . setAttribute ( 'type' , 'button' ) ;
489
476
}
490
477
}
0 commit comments