7
7
OnInit ,
8
8
ElementRef ,
9
9
Optional ,
10
- ChangeDetectorRef ,
11
10
AfterViewChecked ,
12
- AfterContentChecked ,
13
11
} from '@angular/core' ;
14
12
import {
15
13
trigger ,
@@ -75,7 +73,7 @@ export type MdTabBodyOriginState = 'left' | 'right';
75
73
] )
76
74
]
77
75
} )
78
- export class MdTabBody implements OnInit , AfterViewChecked , AfterContentChecked {
76
+ export class MdTabBody implements OnInit , AfterViewChecked {
79
77
/** The portal host inside of this container into which the tab body content will be loaded. */
80
78
@ViewChild ( PortalHostDirective ) _portalHost : PortalHostDirective ;
81
79
@@ -102,9 +100,6 @@ export class MdTabBody implements OnInit, AfterViewChecked, AfterContentChecked
102
100
}
103
101
}
104
102
105
- /** Whether the element is allowed to be animated. */
106
- _canBeAnimated : boolean = false ;
107
-
108
103
/** The origin position from which this tab should appear when it is centered into view. */
109
104
_origin : MdTabBodyOriginState ;
110
105
@@ -120,10 +115,7 @@ export class MdTabBody implements OnInit, AfterViewChecked, AfterContentChecked
120
115
}
121
116
}
122
117
123
- constructor (
124
- @Optional ( ) private _dir : Dir ,
125
- private _elementRef : ElementRef ,
126
- private _changeDetectorRef : ChangeDetectorRef ) { }
118
+ constructor ( @Optional ( ) private _dir : Dir , private _elementRef : ElementRef ) { }
127
119
128
120
/**
129
121
* 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
145
137
}
146
138
}
147
139
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
-
169
140
_onTranslateTabStarted ( e : AnimationEvent ) {
170
141
if ( this . _isCenterPosition ( e . toState ) ) {
171
142
this . onCentering . emit ( this . _elementRef . nativeElement . clientHeight ) ;
0 commit comments