From 2b0315d3a267bc083db17580ff05ca5281280b13 Mon Sep 17 00:00:00 2001 From: Jeremy Elbourn Date: Wed, 20 Sep 2017 15:58:55 -0700 Subject: [PATCH] feat: add `preserveWhitespaces: false` to all components (#7115) Also adds lint check to enforce its presence --- src/cdk/stepper/stepper.ts | 3 ++- src/cdk/table/row.ts | 2 ++ src/cdk/table/table.ts | 1 + src/demo-app/a11y/a11y.ts | 1 + src/demo-app/a11y/icon/icon-a11y.ts | 1 + src/demo-app/autocomplete/autocomplete-demo.ts | 3 ++- src/demo-app/demo-app/demo-app.ts | 2 ++ src/demo-app/expansion/expansion-demo.ts | 1 + src/demo-app/icon/icon-demo.ts | 1 + src/demo-app/overlay/overlay-demo.ts | 1 + src/demo-app/sidenav/sidenav-demo.ts | 1 + src/demo-app/snack-bar/snack-bar-demo.ts | 1 + src/demo-app/tabs/tabs-demo.ts | 1 + src/demo-app/tooltip/tooltip-demo.ts | 1 + src/lib/autocomplete/autocomplete.ts | 1 + src/lib/button-toggle/button-toggle.ts | 1 + src/lib/button/button.ts | 2 ++ src/lib/card/card.ts | 3 +++ src/lib/checkbox/checkbox.ts | 1 + src/lib/chips/chip-list.ts | 1 + src/lib/core/option/optgroup.ts | 1 + src/lib/core/option/option.ts | 1 + .../core/selection/pseudo-checkbox/pseudo-checkbox.ts | 1 + src/lib/datepicker/calendar-body.ts | 1 + src/lib/datepicker/calendar.ts | 1 + src/lib/datepicker/datepicker-toggle.ts | 1 + src/lib/datepicker/datepicker.ts | 2 ++ src/lib/datepicker/month-view.ts | 1 + src/lib/datepicker/year-view.ts | 1 + src/lib/dialog/dialog-container.ts | 1 + src/lib/expansion/expansion-panel-header.ts | 1 + src/lib/expansion/expansion-panel.ts | 1 + src/lib/form-field/form-field.ts | 1 + src/lib/grid-list/grid-list.ts | 1 + src/lib/grid-list/grid-tile.ts | 2 ++ src/lib/icon/icon.ts | 1 + src/lib/list/list.ts | 2 ++ src/lib/list/selection-list.ts | 2 ++ src/lib/menu/menu-directive.ts | 1 + src/lib/menu/menu-item.ts | 1 + src/lib/paginator/paginator.ts | 1 + src/lib/progress-bar/progress-bar.ts | 1 + src/lib/progress-spinner/progress-spinner.ts | 2 ++ src/lib/radio/radio.ts | 1 + src/lib/select/select.ts | 1 + src/lib/sidenav/drawer.ts | 2 ++ src/lib/sidenav/sidenav.ts | 2 ++ src/lib/slide-toggle/slide-toggle.ts | 1 + src/lib/slider/slider.ts | 1 + src/lib/snack-bar/simple-snack-bar.ts | 1 + src/lib/snack-bar/snack-bar-container.ts | 1 + src/lib/sort/sort-header.ts | 1 + src/lib/stepper/step-header.ts | 1 + src/lib/stepper/stepper.ts | 9 ++++++--- src/lib/table/row.ts | 2 ++ src/lib/table/table.ts | 1 + src/lib/tabs/tab-body.ts | 1 + src/lib/tabs/tab-group.ts | 1 + src/lib/tabs/tab-header.ts | 1 + src/lib/tabs/tab-nav-bar/tab-nav-bar.ts | 1 + src/lib/tabs/tab.ts | 1 + src/lib/toolbar/toolbar.ts | 3 ++- src/lib/tooltip/tooltip.ts | 1 + src/material-examples/sidenav-fab/sidenav-fab-example.ts | 1 + .../slider-configurable/slider-configurable-example.ts | 1 + tslint.json | 3 ++- 66 files changed, 88 insertions(+), 7 deletions(-) diff --git a/src/cdk/stepper/stepper.ts b/src/cdk/stepper/stepper.ts index eb0b5b9b4449..30b12781b759 100644 --- a/src/cdk/stepper/stepper.ts +++ b/src/cdk/stepper/stepper.ts @@ -60,7 +60,8 @@ export class StepperSelectionEvent { moduleId: module.id, selector: 'cdk-step', templateUrl: 'step.html', - encapsulation: ViewEncapsulation.None + encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class CdkStep { /** Template for step label if it exists. */ diff --git a/src/cdk/table/row.ts b/src/cdk/table/row.ts index 037cdeae5e5e..5be5dc7742d7 100644 --- a/src/cdk/table/row.ts +++ b/src/cdk/table/row.ts @@ -150,6 +150,7 @@ export class CdkCellOutlet { }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class CdkHeaderRow { } @@ -164,5 +165,6 @@ export class CdkHeaderRow { } }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class CdkRow { } diff --git a/src/cdk/table/table.ts b/src/cdk/table/table.ts index 791fc39a483a..e00568d29961 100644 --- a/src/cdk/table/table.ts +++ b/src/cdk/table/table.ts @@ -76,6 +76,7 @@ export const CDK_TABLE_TEMPLATE = ` 'class': 'cdk-table', }, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class CdkTable implements CollectionViewer { diff --git a/src/demo-app/a11y/a11y.ts b/src/demo-app/a11y/a11y.ts index 644430399887..f522717c5b2e 100644 --- a/src/demo-app/a11y/a11y.ts +++ b/src/demo-app/a11y/a11y.ts @@ -13,6 +13,7 @@ export class AccessibilityHome {} templateUrl: 'a11y.html', styleUrls: ['a11y.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class AccessibilityDemo { @ViewChild('maincontent') mainContent: ElementRef; diff --git a/src/demo-app/a11y/icon/icon-a11y.ts b/src/demo-app/a11y/icon/icon-a11y.ts index dfac7d4c04ea..9a5ae09bd96e 100644 --- a/src/demo-app/a11y/icon/icon-a11y.ts +++ b/src/demo-app/a11y/icon/icon-a11y.ts @@ -6,6 +6,7 @@ import {MdSnackBar} from '@angular/material'; selector: 'icon-a11y', templateUrl: 'icon-a11y.html', encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class IconAccessibilityDemo { constructor(private snackBar: MdSnackBar) {} diff --git a/src/demo-app/autocomplete/autocomplete-demo.ts b/src/demo-app/autocomplete/autocomplete-demo.ts index a138a007df82..dc5a486e80f7 100644 --- a/src/demo-app/autocomplete/autocomplete-demo.ts +++ b/src/demo-app/autocomplete/autocomplete-demo.ts @@ -18,7 +18,8 @@ export interface StateGroup { selector: 'autocomplete-demo', templateUrl: 'autocomplete-demo.html', styleUrls: ['autocomplete-demo.css'], - encapsulation: ViewEncapsulation.None + encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class AutocompleteDemo { stateCtrl: FormControl; diff --git a/src/demo-app/demo-app/demo-app.ts b/src/demo-app/demo-app/demo-app.ts index 4d43f5711873..93a647f91978 100644 --- a/src/demo-app/demo-app/demo-app.ts +++ b/src/demo-app/demo-app/demo-app.ts @@ -17,6 +17,7 @@ import {OverlayContainer} from '@angular/cdk/overlay'; selector: 'entry-app', template: '', encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class EntryApp {} @@ -41,6 +42,7 @@ export class Home {} templateUrl: 'demo-app.html', styleUrls: ['demo-app.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class DemoApp { dark = false; diff --git a/src/demo-app/expansion/expansion-demo.ts b/src/demo-app/expansion/expansion-demo.ts index 868c04e564b5..e3ae3dee100d 100644 --- a/src/demo-app/expansion/expansion-demo.ts +++ b/src/demo-app/expansion/expansion-demo.ts @@ -6,6 +6,7 @@ import {Component, ViewEncapsulation} from '@angular/core'; styleUrls: ['expansion-demo.css'], templateUrl: 'expansion-demo.html', encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class ExpansionDemo { displayMode: string = 'default'; diff --git a/src/demo-app/icon/icon-demo.ts b/src/demo-app/icon/icon-demo.ts index 67faa801d2a9..e5975d672a2d 100644 --- a/src/demo-app/icon/icon-demo.ts +++ b/src/demo-app/icon/icon-demo.ts @@ -8,6 +8,7 @@ import {MdIconRegistry} from '@angular/material'; templateUrl: 'icon-demo.html', styleUrls: ['icon-demo.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class IconDemo { constructor(mdIconRegistry: MdIconRegistry, sanitizer: DomSanitizer) { diff --git a/src/demo-app/overlay/overlay-demo.ts b/src/demo-app/overlay/overlay-demo.ts index 1cf11b4796aa..1406c4b286d9 100644 --- a/src/demo-app/overlay/overlay-demo.ts +++ b/src/demo-app/overlay/overlay-demo.ts @@ -23,6 +23,7 @@ import { templateUrl: 'overlay-demo.html', styleUrls: ['overlay-demo.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class OverlayDemo { nextPosition: number = 0; diff --git a/src/demo-app/sidenav/sidenav-demo.ts b/src/demo-app/sidenav/sidenav-demo.ts index 5d72a469a5df..60be081c2a85 100644 --- a/src/demo-app/sidenav/sidenav-demo.ts +++ b/src/demo-app/sidenav/sidenav-demo.ts @@ -7,6 +7,7 @@ import {Component, ViewEncapsulation} from '@angular/core'; templateUrl: 'sidenav-demo.html', styleUrls: ['sidenav-demo.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class SidenavDemo { invert = false; diff --git a/src/demo-app/snack-bar/snack-bar-demo.ts b/src/demo-app/snack-bar/snack-bar-demo.ts index 6f905ce052ba..8138d60796a1 100644 --- a/src/demo-app/snack-bar/snack-bar-demo.ts +++ b/src/demo-app/snack-bar/snack-bar-demo.ts @@ -13,6 +13,7 @@ import { styleUrls: ['snack-bar-demo.css'], templateUrl: 'snack-bar-demo.html', encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class SnackBarDemo { message: string = 'Snack Bar opened.'; diff --git a/src/demo-app/tabs/tabs-demo.ts b/src/demo-app/tabs/tabs-demo.ts index d5eedce2ef86..84e442de1e7a 100644 --- a/src/demo-app/tabs/tabs-demo.ts +++ b/src/demo-app/tabs/tabs-demo.ts @@ -7,6 +7,7 @@ import {Observable} from 'rxjs/Observable'; templateUrl: 'tabs-demo.html', styleUrls: ['tabs-demo.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class TabsDemo { // Nav bar demo diff --git a/src/demo-app/tooltip/tooltip-demo.ts b/src/demo-app/tooltip/tooltip-demo.ts index 95b79d9f49b9..6839192a7118 100644 --- a/src/demo-app/tooltip/tooltip-demo.ts +++ b/src/demo-app/tooltip/tooltip-demo.ts @@ -8,6 +8,7 @@ import {TooltipPosition} from '@angular/material'; templateUrl: 'tooltip-demo.html', styleUrls: ['tooltip-demo.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class TooltipDemo { position: TooltipPosition = 'below'; diff --git a/src/lib/autocomplete/autocomplete.ts b/src/lib/autocomplete/autocomplete.ts index e9041dee1533..24c29d411fd7 100644 --- a/src/lib/autocomplete/autocomplete.ts +++ b/src/lib/autocomplete/autocomplete.ts @@ -43,6 +43,7 @@ export class MdAutocompleteSelectedEvent { templateUrl: 'autocomplete.html', styleUrls: ['autocomplete.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'mdAutocomplete, matAutocomplete', host: { diff --git a/src/lib/button-toggle/button-toggle.ts b/src/lib/button-toggle/button-toggle.ts index a38023fedfa5..cb45c07dec00 100644 --- a/src/lib/button-toggle/button-toggle.ts +++ b/src/lib/button-toggle/button-toggle.ts @@ -262,6 +262,7 @@ export class MdButtonToggleGroupMultiple extends _MdButtonToggleGroupMixinBase templateUrl: 'button-toggle.html', styleUrls: ['button-toggle.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, host: { '[class.mat-button-toggle-standalone]': '!buttonToggleGroup && !buttonToggleGroupMultiple', diff --git a/src/lib/button/button.ts b/src/lib/button/button.ts index 208a16f04d89..ebfb6960d120 100644 --- a/src/lib/button/button.ts +++ b/src/lib/button/button.ts @@ -128,6 +128,7 @@ export const _MdButtonMixinBase = mixinColor(mixinDisabled(mixinDisableRipple(Md styleUrls: ['button.css'], inputs: ['disabled', 'disableRipple', 'color'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdButton extends _MdButtonMixinBase @@ -201,6 +202,7 @@ export class MdButton extends _MdButtonMixinBase templateUrl: 'button.html', styleUrls: ['button.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdAnchor extends MdButton { diff --git a/src/lib/card/card.ts b/src/lib/card/card.ts index 71ef6e192435..2ec494d2b118 100644 --- a/src/lib/card/card.ts +++ b/src/lib/card/card.ts @@ -155,6 +155,7 @@ export class MdCardAvatar {} templateUrl: 'card.html', styleUrls: ['card.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, host: {'class': 'mat-card'} }) @@ -171,6 +172,7 @@ export class MdCard {} selector: 'md-card-header, mat-card-header', templateUrl: 'card-header.html', encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, host: {'class': 'mat-card-header'} }) @@ -187,6 +189,7 @@ export class MdCardHeader {} selector: 'md-card-title-group, mat-card-title-group', templateUrl: 'card-title-group.html', encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, host: {'class': 'mat-card-title-group'} }) diff --git a/src/lib/checkbox/checkbox.ts b/src/lib/checkbox/checkbox.ts index c94975d72c76..fa32e27a6f45 100644 --- a/src/lib/checkbox/checkbox.ts +++ b/src/lib/checkbox/checkbox.ts @@ -106,6 +106,7 @@ export const _MdCheckboxMixinBase = providers: [MD_CHECKBOX_CONTROL_VALUE_ACCESSOR], inputs: ['disabled', 'disableRipple', 'color'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush }) export class MdCheckbox extends _MdCheckboxMixinBase implements ControlValueAccessor, AfterViewInit, diff --git a/src/lib/chips/chip-list.ts b/src/lib/chips/chip-list.ts index 0643aeb9978c..fdd510ca2e05 100644 --- a/src/lib/chips/chip-list.ts +++ b/src/lib/chips/chip-list.ts @@ -83,6 +83,7 @@ export class MdChipListChange { providers: [{provide: MdFormFieldControl, useExisting: MdChipList}], styleUrls: ['chips.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush }) export class MdChipList implements MdFormFieldControl, ControlValueAccessor, diff --git a/src/lib/core/option/optgroup.ts b/src/lib/core/option/optgroup.ts index 0a2937eb979b..f904895ac8d2 100644 --- a/src/lib/core/option/optgroup.ts +++ b/src/lib/core/option/optgroup.ts @@ -25,6 +25,7 @@ let _uniqueOptgroupIdCounter = 0; selector: 'md-optgroup, mat-optgroup', templateUrl: 'optgroup.html', encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['disabled'], host: { diff --git a/src/lib/core/option/option.ts b/src/lib/core/option/option.ts index 09730a275466..ebb95a93330f 100644 --- a/src/lib/core/option/option.ts +++ b/src/lib/core/option/option.ts @@ -57,6 +57,7 @@ export class MdOptionSelectionChange { }, templateUrl: 'option.html', encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdOption { diff --git a/src/lib/core/selection/pseudo-checkbox/pseudo-checkbox.ts b/src/lib/core/selection/pseudo-checkbox/pseudo-checkbox.ts index a47534db61fe..db3e5331b153 100644 --- a/src/lib/core/selection/pseudo-checkbox/pseudo-checkbox.ts +++ b/src/lib/core/selection/pseudo-checkbox/pseudo-checkbox.ts @@ -26,6 +26,7 @@ export type MdPseudoCheckboxState = 'unchecked' | 'checked' | 'indeterminate'; @Component({ moduleId: module.id, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, selector: 'md-pseudo-checkbox, mat-pseudo-checkbox', styleUrls: ['pseudo-checkbox.css'], diff --git a/src/lib/datepicker/calendar-body.ts b/src/lib/datepicker/calendar-body.ts index 3dfa45a8513f..c6a2d70d2bd0 100644 --- a/src/lib/datepicker/calendar-body.ts +++ b/src/lib/datepicker/calendar-body.ts @@ -41,6 +41,7 @@ export class MdCalendarCell { 'class': 'mat-calendar-body', }, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdCalendarBody { diff --git a/src/lib/datepicker/calendar.ts b/src/lib/datepicker/calendar.ts index fd4cb3f5fa1f..32a43d5f39c2 100644 --- a/src/lib/datepicker/calendar.ts +++ b/src/lib/datepicker/calendar.ts @@ -57,6 +57,7 @@ import {MdDatepickerIntl} from './datepicker-intl'; 'class': 'mat-calendar', }, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdCalendar implements AfterContentInit, OnDestroy { diff --git a/src/lib/datepicker/datepicker-toggle.ts b/src/lib/datepicker/datepicker-toggle.ts index 44698e2fbd10..006ee0cb7520 100644 --- a/src/lib/datepicker/datepicker-toggle.ts +++ b/src/lib/datepicker/datepicker-toggle.ts @@ -32,6 +32,7 @@ import {of as observableOf} from 'rxjs/observable/of'; 'class': 'mat-datepicker-toggle', }, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdDatepickerToggle implements OnChanges, OnDestroy { diff --git a/src/lib/datepicker/datepicker.ts b/src/lib/datepicker/datepicker.ts index df5c6190499e..0688d645f788 100644 --- a/src/lib/datepicker/datepicker.ts +++ b/src/lib/datepicker/datepicker.ts @@ -85,6 +85,7 @@ export const MD_DATEPICKER_SCROLL_STRATEGY_PROVIDER = { '(keydown)': '_handleKeydown($event)', }, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdDatepickerContent implements AfterContentInit { @@ -120,6 +121,7 @@ export class MdDatepickerContent implements AfterContentInit { template: '', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdDatepicker implements OnDestroy { /** The date to open the calendar to initially. */ diff --git a/src/lib/datepicker/month-view.ts b/src/lib/datepicker/month-view.ts index 379d2edc1c18..9cb2914578e0 100644 --- a/src/lib/datepicker/month-view.ts +++ b/src/lib/datepicker/month-view.ts @@ -34,6 +34,7 @@ const DAYS_PER_WEEK = 7; selector: 'md-month-view', templateUrl: 'month-view.html', encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdMonthView implements AfterContentInit { diff --git a/src/lib/datepicker/year-view.ts b/src/lib/datepicker/year-view.ts index 81560fbf93ee..8bf750b7776c 100644 --- a/src/lib/datepicker/year-view.ts +++ b/src/lib/datepicker/year-view.ts @@ -31,6 +31,7 @@ import {createMissingDateImplError} from './datepicker-errors'; selector: 'md-year-view, mat-year-view', templateUrl: 'year-view.html', encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdYearView implements AfterContentInit { diff --git a/src/lib/dialog/dialog-container.ts b/src/lib/dialog/dialog-container.ts index 40e48f3c4e05..0fc71833df46 100644 --- a/src/lib/dialog/dialog-container.ts +++ b/src/lib/dialog/dialog-container.ts @@ -50,6 +50,7 @@ export function throwMdDialogContentAlreadyAttachedError() { templateUrl: 'dialog-container.html', styleUrls: ['dialog.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, animations: [ trigger('slideDialog', [ // Note: The `enter` animation doesn't transition to something like `translate3d(0, 0, 0) diff --git a/src/lib/expansion/expansion-panel-header.ts b/src/lib/expansion/expansion-panel-header.ts index afdfad08d6af..e18cfe61a67b 100644 --- a/src/lib/expansion/expansion-panel-header.ts +++ b/src/lib/expansion/expansion-panel-header.ts @@ -46,6 +46,7 @@ import {Subscription} from 'rxjs/Subscription'; styleUrls: ['./expansion-panel-header.css'], templateUrl: './expansion-panel-header.html', encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, host: { 'class': 'mat-expansion-panel-header', diff --git a/src/lib/expansion/expansion-panel.ts b/src/lib/expansion/expansion-panel.ts index 8b76f72970ec..5ed09e2fcf79 100644 --- a/src/lib/expansion/expansion-panel.ts +++ b/src/lib/expansion/expansion-panel.ts @@ -58,6 +58,7 @@ export const EXPANSION_PANEL_ANIMATION_TIMING = '225ms cubic-bezier(0.4,0.0,0.2, selector: 'md-expansion-panel, mat-expansion-panel', templateUrl: './expansion-panel.html', encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['disabled', 'expanded'], host: { diff --git a/src/lib/form-field/form-field.ts b/src/lib/form-field/form-field.ts index e986fd30d8b2..c0644f2abdae 100644 --- a/src/lib/form-field/form-field.ts +++ b/src/lib/form-field/form-field.ts @@ -83,6 +83,7 @@ let nextUniqueId = 0; '(click)': '_control.focus()', }, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) diff --git a/src/lib/grid-list/grid-list.ts b/src/lib/grid-list/grid-list.ts index 5a5581995835..bfa2c9a802b3 100644 --- a/src/lib/grid-list/grid-list.ts +++ b/src/lib/grid-list/grid-list.ts @@ -45,6 +45,7 @@ const MD_FIT_MODE = 'fit'; }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdGridList implements OnInit, AfterContentChecked { /** Number of columns being rendered. */ diff --git a/src/lib/grid-list/grid-tile.ts b/src/lib/grid-list/grid-tile.ts index 72b1d9427ca6..62443ef026e6 100644 --- a/src/lib/grid-list/grid-tile.ts +++ b/src/lib/grid-list/grid-tile.ts @@ -30,6 +30,7 @@ import {coerceToNumber} from './grid-list-measure'; templateUrl: 'grid-tile.html', styleUrls: ['grid-list.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdGridTile { @@ -63,6 +64,7 @@ export class MdGridTile { templateUrl: 'grid-tile-text.html', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdGridTileText implements AfterContentInit { /** diff --git a/src/lib/icon/icon.ts b/src/lib/icon/icon.ts index b10ddcf96953..f27d46ea5d29 100644 --- a/src/lib/icon/icon.ts +++ b/src/lib/icon/icon.ts @@ -69,6 +69,7 @@ export const _MdIconMixinBase = mixinColor(MdIconBase); 'class': 'mat-icon', }, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdIcon extends _MdIconMixinBase implements OnChanges, OnInit, CanColor { diff --git a/src/lib/list/list.ts b/src/lib/list/list.ts index ef345319f1f2..06051afc267a 100644 --- a/src/lib/list/list.ts +++ b/src/lib/list/list.ts @@ -52,6 +52,7 @@ export class MdListDivider {} styleUrls: ['list.css'], inputs: ['disableRipple'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdList extends _MdListMixinBase implements CanDisableRipple {} @@ -129,6 +130,7 @@ export class MdListSubheaderCssMatStyler {} inputs: ['disableRipple'], templateUrl: 'list-item.html', encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdListItem extends _MdListItemMixinBase implements AfterContentInit, CanDisableRipple { diff --git a/src/lib/list/selection-list.ts b/src/lib/list/selection-list.ts index df76d6ec39e0..852eaf74d137 100644 --- a/src/lib/list/selection-list.ts +++ b/src/lib/list/selection-list.ts @@ -81,6 +81,7 @@ const FOCUSED_STYLE: string = 'mat-list-item-focus'; }, templateUrl: 'list-option.html', encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, providers: [{provide: MATERIAL_COMPATIBILITY_MODE, useValue: false}], }) @@ -201,6 +202,7 @@ export class MdListOption extends _MdListOptionMixinBase template: '', styleUrls: ['list.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush }) export class MdSelectionList extends _MdSelectionListMixinBase diff --git a/src/lib/menu/menu-directive.ts b/src/lib/menu/menu-directive.ts index 3c673254278f..594de4d5e5e0 100644 --- a/src/lib/menu/menu-directive.ts +++ b/src/lib/menu/menu-directive.ts @@ -62,6 +62,7 @@ const MD_MENU_BASE_ELEVATION = 2; styleUrls: ['menu.css'], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, animations: [ transformMenu, fadeInItems diff --git a/src/lib/menu/menu-item.ts b/src/lib/menu/menu-item.ts index a0745fe3baf5..b801dc6c2940 100644 --- a/src/lib/menu/menu-item.ts +++ b/src/lib/menu/menu-item.ts @@ -43,6 +43,7 @@ export const _MdMenuItemMixinBase = mixinDisabled(MdMenuItemBase); }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, templateUrl: 'menu-item.html', exportAs: 'mdMenuItem, matMenuItem', }) diff --git a/src/lib/paginator/paginator.ts b/src/lib/paginator/paginator.ts index b4c04903558f..a0903e392cbf 100644 --- a/src/lib/paginator/paginator.ts +++ b/src/lib/paginator/paginator.ts @@ -57,6 +57,7 @@ export class PageEvent { ], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdPaginator implements OnInit, OnDestroy { private _initialized: boolean; diff --git a/src/lib/progress-bar/progress-bar.ts b/src/lib/progress-bar/progress-bar.ts index 83e3a4ead8f1..36bdc00aa7d5 100644 --- a/src/lib/progress-bar/progress-bar.ts +++ b/src/lib/progress-bar/progress-bar.ts @@ -33,6 +33,7 @@ import {Component, ChangeDetectionStrategy, Input, ViewEncapsulation} from '@ang styleUrls: ['progress-bar.css'], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdProgressBar { /** Color of the progress bar. */ diff --git a/src/lib/progress-spinner/progress-spinner.ts b/src/lib/progress-spinner/progress-spinner.ts index ee4ec891a231..136a18335815 100644 --- a/src/lib/progress-spinner/progress-spinner.ts +++ b/src/lib/progress-spinner/progress-spinner.ts @@ -82,6 +82,7 @@ export const _MdProgressSpinnerMixinBase = mixinColor(MdProgressSpinnerBase, 'pr styleUrls: ['progress-spinner.css'], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdProgressSpinner extends _MdProgressSpinnerMixinBase implements OnDestroy, CanColor { @@ -289,6 +290,7 @@ export class MdProgressSpinner extends _MdProgressSpinnerMixinBase styleUrls: ['progress-spinner.css'], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdSpinner extends MdProgressSpinner { constructor(elementRef: ElementRef, ngZone: NgZone, renderer: Renderer2) { diff --git a/src/lib/radio/radio.ts b/src/lib/radio/radio.ts index c30a1ddd848e..652a70154129 100644 --- a/src/lib/radio/radio.ts +++ b/src/lib/radio/radio.ts @@ -326,6 +326,7 @@ export const _MdRadioButtonMixinBase = mixinColor(mixinDisableRipple(MdRadioButt styleUrls: ['radio.css'], inputs: ['color', 'disableRipple'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, host: { 'class': 'mat-radio-button', '[class.mat-radio-checked]': 'checked', diff --git a/src/lib/select/select.ts b/src/lib/select/select.ts index d7a20d8fc639..8601e3066dcb 100644 --- a/src/lib/select/select.ts +++ b/src/lib/select/select.ts @@ -178,6 +178,7 @@ export class MdSelectTrigger {} styleUrls: ['select.css'], inputs: ['color', 'disabled', 'tabIndex'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, host: { 'role': 'listbox', diff --git a/src/lib/sidenav/drawer.ts b/src/lib/sidenav/drawer.ts index ea4d0af73d96..52271e625fc7 100644 --- a/src/lib/sidenav/drawer.ts +++ b/src/lib/sidenav/drawer.ts @@ -89,6 +89,7 @@ export class MdDrawerToggleResult { }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdDrawer implements AfterContentInit, OnDestroy { private _focusTrap: FocusTrap; @@ -313,6 +314,7 @@ export class MdDrawer implements AfterContentInit, OnDestroy { }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdDrawerContainer implements AfterContentInit, OnDestroy { @ContentChildren(MdDrawer) _drawers: QueryList; diff --git a/src/lib/sidenav/sidenav.ts b/src/lib/sidenav/sidenav.ts index 05f65c0e3af3..12e8b925bcfa 100644 --- a/src/lib/sidenav/sidenav.ts +++ b/src/lib/sidenav/sidenav.ts @@ -50,6 +50,7 @@ import {animate, state, style, transition, trigger} from '@angular/animations'; }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdSidenav extends MdDrawer {} @@ -67,6 +68,7 @@ export class MdSidenav extends MdDrawer {} }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdSidenavContainer extends MdDrawerContainer { @ContentChildren(MdSidenav) _drawers; diff --git a/src/lib/slide-toggle/slide-toggle.ts b/src/lib/slide-toggle/slide-toggle.ts index d7b6b2b895c6..d9e9c74233ea 100644 --- a/src/lib/slide-toggle/slide-toggle.ts +++ b/src/lib/slide-toggle/slide-toggle.ts @@ -76,6 +76,7 @@ export const _MdSlideToggleMixinBase = providers: [MD_SLIDE_TOGGLE_VALUE_ACCESSOR], inputs: ['disabled', 'disableRipple', 'color', 'tabIndex'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush }) export class MdSlideToggle extends _MdSlideToggleMixinBase implements OnDestroy, AfterContentInit, diff --git a/src/lib/slider/slider.ts b/src/lib/slider/slider.ts index 0f78a906429d..25dda65e0354 100644 --- a/src/lib/slider/slider.ts +++ b/src/lib/slider/slider.ts @@ -127,6 +127,7 @@ export const _MdSliderMixinBase = mixinColor(mixinDisabled(MdSliderBase), 'accen styleUrls: ['slider.css'], inputs: ['disabled', 'color'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdSlider extends _MdSliderMixinBase diff --git a/src/lib/snack-bar/simple-snack-bar.ts b/src/lib/snack-bar/simple-snack-bar.ts index d2db0ef2e206..e0236fd0e4c8 100644 --- a/src/lib/snack-bar/simple-snack-bar.ts +++ b/src/lib/snack-bar/simple-snack-bar.ts @@ -21,6 +21,7 @@ import {MD_SNACK_BAR_DATA} from './snack-bar-config'; templateUrl: 'simple-snack-bar.html', styleUrls: ['simple-snack-bar.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, host: { 'class': 'mat-simple-snackbar', diff --git a/src/lib/snack-bar/snack-bar-container.ts b/src/lib/snack-bar/snack-bar-container.ts index 0828b73cd12d..79688edc6731 100644 --- a/src/lib/snack-bar/snack-bar-container.ts +++ b/src/lib/snack-bar/snack-bar-container.ts @@ -56,6 +56,7 @@ export const HIDE_ANIMATION = '195ms cubic-bezier(0.0,0.0,0.2,1)'; styleUrls: ['snack-bar-container.css'], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, host: { 'role': 'alert', 'class': 'mat-snack-bar-container', diff --git a/src/lib/sort/sort-header.ts b/src/lib/sort/sort-header.ts index de8d3628a01e..5547cce09be1 100644 --- a/src/lib/sort/sort-header.ts +++ b/src/lib/sort/sort-header.ts @@ -52,6 +52,7 @@ const SORT_ANIMATION_TRANSITION = '[class.mat-sort-header-sorted]': '_isSorted()', }, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, animations: [ trigger('indicator', [ diff --git a/src/lib/stepper/step-header.ts b/src/lib/stepper/step-header.ts index 10176b3c2424..d610db9a73b3 100644 --- a/src/lib/stepper/step-header.ts +++ b/src/lib/stepper/step-header.ts @@ -22,6 +22,7 @@ import {MdStepLabel} from './step-label'; 'role': 'tab', }, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, providers: [{provide: MATERIAL_COMPATIBILITY_MODE, useValue: false}], }) export class MdStepHeader { diff --git a/src/lib/stepper/stepper.ts b/src/lib/stepper/stepper.ts index 3ffab445a85b..6c2098e5e065 100644 --- a/src/lib/stepper/stepper.ts +++ b/src/lib/stepper/stepper.ts @@ -41,7 +41,8 @@ export const _MdStepper = CdkStepper; selector: 'md-step, mat-step', templateUrl: 'step.html', providers: [{provide: MD_ERROR_GLOBAL_OPTIONS, useExisting: MdStep}], - encapsulation: ViewEncapsulation.None + encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdStep extends _MdStep implements ErrorOptions { /** Content for step label given by or . */ @@ -104,7 +105,8 @@ export class MdStepper extends _MdStepper { ]) ], providers: [{provide: MdStepper, useExisting: MdHorizontalStepper}], - encapsulation: ViewEncapsulation.None + encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdHorizontalStepper extends MdStepper { } @@ -127,6 +129,7 @@ export class MdHorizontalStepper extends MdStepper { } ]) ], providers: [{provide: MdStepper, useExisting: MdVerticalStepper}], - encapsulation: ViewEncapsulation.None + encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdVerticalStepper extends MdStepper { } diff --git a/src/lib/table/row.ts b/src/lib/table/row.ts index 48fbf4cb8d6d..20857c9ca12a 100644 --- a/src/lib/table/row.ts +++ b/src/lib/table/row.ts @@ -70,6 +70,7 @@ export class MatRowDef extends _MdCdkRowDef { } }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdHeaderRow extends _MdHeaderRow { } @@ -84,5 +85,6 @@ export class MdHeaderRow extends _MdHeaderRow { } }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdRow extends _MdRow { } diff --git a/src/lib/table/table.ts b/src/lib/table/table.ts index fd452d1f953a..d0ecc92bede3 100644 --- a/src/lib/table/table.ts +++ b/src/lib/table/table.ts @@ -24,6 +24,7 @@ export const _MdTable = CdkTable; 'class': 'mat-table', }, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdTable extends _MdTable { } diff --git a/src/lib/tabs/tab-body.ts b/src/lib/tabs/tab-body.ts index ce54ea95778c..7af7a6e8593f 100644 --- a/src/lib/tabs/tab-body.ts +++ b/src/lib/tabs/tab-body.ts @@ -62,6 +62,7 @@ export type MdTabBodyOriginState = 'left' | 'right'; templateUrl: 'tab-body.html', styleUrls: ['tab-body.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, host: { 'class': 'mat-tab-body', diff --git a/src/lib/tabs/tab-group.ts b/src/lib/tabs/tab-group.ts index 1521c92382ac..5a7297cd89c3 100644 --- a/src/lib/tabs/tab-group.ts +++ b/src/lib/tabs/tab-group.ts @@ -62,6 +62,7 @@ export const _MdTabGroupMixinBase = mixinColor(mixinDisableRipple(MdTabGroupBase templateUrl: 'tab-group.html', styleUrls: ['tab-group.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['color', 'disableRipple'], host: { diff --git a/src/lib/tabs/tab-header.ts b/src/lib/tabs/tab-header.ts index 638c53a268f7..b92d9d15a77d 100644 --- a/src/lib/tabs/tab-header.ts +++ b/src/lib/tabs/tab-header.ts @@ -68,6 +68,7 @@ export const _MdTabHeaderMixinBase = mixinDisableRipple(MdTabHeaderBase); styleUrls: ['tab-header.css'], inputs: ['disableRipple'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, host: { 'class': 'mat-tab-header', diff --git a/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts b/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts index 44a22aa7b18c..506f0564f818 100644 --- a/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts +++ b/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts @@ -68,6 +68,7 @@ export const _MdTabNavMixinBase = mixinDisableRipple(mixinColor(MdTabNavBase, 'p styleUrls: ['tab-nav-bar.css'], host: {'class': 'mat-tab-nav-bar'}, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, }) export class MdTabNav extends _MdTabNavMixinBase implements AfterContentInit, CanColor, diff --git a/src/lib/tabs/tab.ts b/src/lib/tabs/tab.ts index f848e33f0443..a8499dba0e29 100644 --- a/src/lib/tabs/tab.ts +++ b/src/lib/tabs/tab.ts @@ -37,6 +37,7 @@ export const _MdTabMixinBase = mixinDisabled(MdTabBase); inputs: ['disabled'], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, exportAs: 'mdTab, matTab', }) export class MdTab extends _MdTabMixinBase implements OnInit, CanDisable, OnChanges, OnDestroy { diff --git a/src/lib/toolbar/toolbar.ts b/src/lib/toolbar/toolbar.ts index 19bdad5ff463..de05bc8d1257 100644 --- a/src/lib/toolbar/toolbar.ts +++ b/src/lib/toolbar/toolbar.ts @@ -42,7 +42,8 @@ export const _MdToolbarMixinBase = mixinColor(MdToolbarBase); 'role': 'toolbar' }, changeDetection: ChangeDetectionStrategy.OnPush, - encapsulation: ViewEncapsulation.None + encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class MdToolbar extends _MdToolbarMixinBase implements CanColor { diff --git a/src/lib/tooltip/tooltip.ts b/src/lib/tooltip/tooltip.ts index d9fab238996e..296150f34526 100644 --- a/src/lib/tooltip/tooltip.ts +++ b/src/lib/tooltip/tooltip.ts @@ -416,6 +416,7 @@ export type TooltipVisibility = 'initial' | 'visible' | 'hidden'; templateUrl: 'tooltip.html', styleUrls: ['tooltip.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, animations: [ trigger('state', [ diff --git a/src/material-examples/sidenav-fab/sidenav-fab-example.ts b/src/material-examples/sidenav-fab/sidenav-fab-example.ts index cd228e86f61a..4af25f478ac0 100644 --- a/src/material-examples/sidenav-fab/sidenav-fab-example.ts +++ b/src/material-examples/sidenav-fab/sidenav-fab-example.ts @@ -8,5 +8,6 @@ import {Component, ViewEncapsulation} from '@angular/core'; templateUrl: 'sidenav-fab-example.html', styleUrls: ['sidenav-fab-example.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class SidenavFabExample {} diff --git a/src/material-examples/slider-configurable/slider-configurable-example.ts b/src/material-examples/slider-configurable/slider-configurable-example.ts index 80f206709907..caee9ab54cb9 100644 --- a/src/material-examples/slider-configurable/slider-configurable-example.ts +++ b/src/material-examples/slider-configurable/slider-configurable-example.ts @@ -8,6 +8,7 @@ import {Component, ViewEncapsulation} from '@angular/core'; templateUrl: 'slider-configurable-example.html', styleUrls: ['slider-configurable-example.css'], encapsulation: ViewEncapsulation.None, + preserveWhitespaces: false, }) export class SliderConfigurableExample { autoTicks = false; diff --git a/tslint.json b/tslint.json index 527240dfd8ef..2e40ca7b22e9 100644 --- a/tslint.json +++ b/tslint.json @@ -90,7 +90,8 @@ "validate-decorators": [true, { "Component": { "encapsulation": "\\.None$", - "moduleId": "^module\\.id$" + "moduleId": "^module\\.id$", + "preserveWhitespaces": "false$" } }, "src/+(lib|cdk)/**/!(*.spec).ts"], "require-license-banner": [