@@ -88,32 +88,23 @@ export class MatList extends _MatListMixinBase implements CanDisableRipple, OnCh
8888 /** Emits when the state of the list changes. */
8989 _stateChanges = new Subject < void > ( ) ;
9090
91- /**
92- * @deprecated _elementRef parameter to be made required.
93- * @breaking -change 8.0.0
94- */
95- constructor ( private _elementRef ?: ElementRef < HTMLElement > ) {
91+ constructor ( private _elementRef : ElementRef < HTMLElement > ) {
9692 super ( ) ;
9793
98- if ( this . _getListType ( ) === 'action-list' && _elementRef ) {
94+ if ( this . _getListType ( ) === 'action-list' ) {
9995 _elementRef . nativeElement . classList . add ( 'mat-action-list' ) ;
10096 }
10197 }
10298
10399 _getListType ( ) : 'list' | 'action-list' | null {
104- const elementRef = this . _elementRef ;
100+ const nodeName = this . _elementRef . nativeElement . nodeName . toLowerCase ( ) ;
105101
106- // @breaking -change 8.0.0 Remove null check once _elementRef is a required param.
107- if ( elementRef ) {
108- const nodeName = elementRef . nativeElement . nodeName . toLowerCase ( ) ;
109-
110- if ( nodeName === 'mat-list' ) {
111- return 'list' ;
112- }
102+ if ( nodeName === 'mat-list' ) {
103+ return 'list' ;
104+ }
113105
114- if ( nodeName === 'mat-action-list' ) {
115- return 'action-list' ;
116- }
106+ if ( nodeName === 'mat-action-list' ) {
107+ return 'action-list' ;
117108 }
118109
119110 return null ;
@@ -185,10 +176,9 @@ export class MatListItem extends _MatListItemMixinBase implements AfterContentIn
185176 @ContentChild ( MatListIconCssMatStyler , { static : false } ) _icon : MatListIconCssMatStyler ;
186177
187178 constructor ( private _element : ElementRef < HTMLElement > ,
179+ _changeDetectorRef : ChangeDetectorRef ,
188180 @Optional ( ) navList ?: MatNavList ,
189- @Optional ( ) list ?: MatList ,
190- // @breaking -change 8.0.0 `_changeDetectorRef` to be made into a required parameter.
191- _changeDetectorRef ?: ChangeDetectorRef ) {
181+ @Optional ( ) list ?: MatList ) {
192182 super ( ) ;
193183 this . _isInteractiveList = ! ! ( navList || ( list && list . _getListType ( ) === 'action-list' ) ) ;
194184 this . _list = navList || list ;
@@ -201,8 +191,7 @@ export class MatListItem extends _MatListItemMixinBase implements AfterContentIn
201191 element . setAttribute ( 'type' , 'button' ) ;
202192 }
203193
204- // @breaking -change 8.0.0 Remove null check for _changeDetectorRef.
205- if ( this . _list && _changeDetectorRef ) {
194+ if ( this . _list ) {
206195 // React to changes in the state of the parent list since
207196 // some of the item's properties depend on it (e.g. `disableRipple`).
208197 this . _list . _stateChanges . pipe ( takeUntil ( this . _destroyed ) ) . subscribe ( ( ) => {
0 commit comments