77 OnInit ,
88 ElementRef ,
99 Optional ,
10- ChangeDetectorRef ,
1110 AfterViewChecked ,
12- AfterContentChecked ,
1311} from '@angular/core' ;
1412import {
1513 trigger ,
@@ -75,7 +73,7 @@ export type MdTabBodyOriginState = 'left' | 'right';
7573 ] )
7674 ]
7775} )
78- export class MdTabBody implements OnInit , AfterViewChecked , AfterContentChecked {
76+ export class MdTabBody implements OnInit , AfterViewChecked {
7977 /** The portal host inside of this container into which the tab body content will be loaded. */
8078 @ViewChild ( PortalHostDirective ) _portalHost : PortalHostDirective ;
8179
@@ -102,9 +100,6 @@ export class MdTabBody implements OnInit, AfterViewChecked, AfterContentChecked
102100 }
103101 }
104102
105- /** Whether the element is allowed to be animated. */
106- _canBeAnimated : boolean = false ;
107-
108103 /** The origin position from which this tab should appear when it is centered into view. */
109104 _origin : MdTabBodyOriginState ;
110105
@@ -120,10 +115,7 @@ export class MdTabBody implements OnInit, AfterViewChecked, AfterContentChecked
120115 }
121116 }
122117
123- constructor (
124- @Optional ( ) private _dir : Dir ,
125- private _elementRef : ElementRef ,
126- private _changeDetectorRef : ChangeDetectorRef ) { }
118+ constructor ( @Optional ( ) private _dir : Dir , private _elementRef : ElementRef ) { }
127119
128120 /**
129121 * After initialized, check if the content is centered and has an origin. If so, set the
@@ -145,27 +137,6 @@ export class MdTabBody implements OnInit, AfterViewChecked, AfterContentChecked
145137 }
146138 }
147139
148- /**
149- * After the content has been checked, determines whether the element should be allowed to
150- * animate. This has to be limited, because under a specific set of circumstances (see #2151),
151- * the animations can be triggered too early, which either crashes Chrome by putting it into an
152- * infinite loop (with Angular < 2.3.0) or throws an error because the element doesn't have a
153- * computed style (with Angular > 2.3.0). This can alternatively be determined by checking the
154- * transform: canBeAnimated = getComputedStyle(element) !== '', however document.contains should
155- * be faster since it doesn't cause a reflow.
156- */
157- ngAfterContentChecked ( ) {
158- // TODO: This can safely be removed after we stop supporting Angular < 2.4.2. The fix landed via
159- // https://github.com/angular/angular/commit/21030e9a1cf30e8101399d8535ed72d847a23ba6
160- if ( ! this . _canBeAnimated ) {
161- this . _canBeAnimated = document . body . contains ( this . _elementRef . nativeElement ) ;
162-
163- if ( this . _canBeAnimated ) {
164- this . _changeDetectorRef . markForCheck ( ) ;
165- }
166- }
167- }
168-
169140 _onTranslateTabStarted ( e : AnimationEvent ) {
170141 if ( this . _isCenterPosition ( e . toState ) ) {
171142 this . onCentering . emit ( this . _elementRef . nativeElement . clientHeight ) ;
0 commit comments