@@ -113,7 +113,7 @@ export class MdGridList implements OnInit, AfterContentChecked {
113
113
private _setTileStyler ( ) : void {
114
114
if ( this . _rowHeight === MD_FIT_MODE ) {
115
115
this . _tileStyler = new FitTileStyler ( ) ;
116
- } else if ( this . _rowHeight && this . _rowHeight . match ( / : / g ) ) {
116
+ } else if ( this . _rowHeight && this . _rowHeight . indexOf ( ':' ) > - 1 ) {
117
117
this . _tileStyler = new RatioTileStyler ( this . _rowHeight ) ;
118
118
} else {
119
119
this . _tileStyler = new FixedTileStyler ( this . _rowHeight ) ;
@@ -122,16 +122,15 @@ export class MdGridList implements OnInit, AfterContentChecked {
122
122
123
123
/** Computes and applies the size and position for all children grid tiles. */
124
124
private _layoutTiles ( ) : void {
125
- let tiles = this . _tiles . toArray ( ) ;
126
- let tracker = new TileCoordinator ( this . cols , tiles ) ;
125
+ let tracker = new TileCoordinator ( this . cols , this . _tiles ) ;
127
126
let direction = this . _dir ? this . _dir . value : 'ltr' ;
128
127
this . _tileStyler . init ( this . gutterSize , tracker , this . cols , direction ) ;
129
128
130
- for ( let i = 0 ; i < tiles . length ; i ++ ) {
131
- let pos = tracker . positions [ i ] ;
132
- let tile = tiles [ i ] ;
129
+ this . _tiles . forEach ( ( tile , index ) => {
130
+ let pos = tracker . positions [ index ] ;
133
131
this . _tileStyler . setStyle ( tile , pos . row , pos . col ) ;
134
- }
132
+ } ) ;
133
+
135
134
this . _setListStyle ( this . _tileStyler . getComputedHeight ( ) ) ;
136
135
}
137
136
0 commit comments