Skip to content

Commit

Permalink
feat: add preserveWhitespaces: false to all components (#7115)
Browse files Browse the repository at this point in the history
Also adds lint check to enforce its presence
  • Loading branch information
jelbourn authored Sep 20, 2017
1 parent 3293a6d commit 2b0315d
Show file tree
Hide file tree
Showing 66 changed files with 88 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/cdk/stepper/stepper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 2 additions & 0 deletions src/cdk/table/row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export class CdkCellOutlet {
},
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
})
export class CdkHeaderRow { }

Expand All @@ -164,5 +165,6 @@ export class CdkHeaderRow { }
},
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
})
export class CdkRow { }
1 change: 1 addition & 0 deletions src/cdk/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const CDK_TABLE_TEMPLATE = `
'class': 'cdk-table',
},
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CdkTable<T> implements CollectionViewer {
Expand Down
1 change: 1 addition & 0 deletions src/demo-app/a11y/a11y.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/demo-app/a11y/icon/icon-a11y.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down
3 changes: 2 additions & 1 deletion src/demo-app/autocomplete/autocomplete-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/demo-app/demo-app/demo-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {OverlayContainer} from '@angular/cdk/overlay';
selector: 'entry-app',
template: '<router-outlet></router-outlet>',
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
})
export class EntryApp {}

Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/demo-app/expansion/expansion-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
1 change: 1 addition & 0 deletions src/demo-app/icon/icon-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/demo-app/overlay/overlay-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
templateUrl: 'overlay-demo.html',
styleUrls: ['overlay-demo.css'],
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
})
export class OverlayDemo {
nextPosition: number = 0;
Expand Down
1 change: 1 addition & 0 deletions src/demo-app/sidenav/sidenav-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/demo-app/snack-bar/snack-bar-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
Expand Down
1 change: 1 addition & 0 deletions src/demo-app/tabs/tabs-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/demo-app/tooltip/tooltip-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
1 change: 1 addition & 0 deletions src/lib/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
1 change: 1 addition & 0 deletions src/lib/button-toggle/button-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions src/lib/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions src/lib/card/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
})
Expand All @@ -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'}
})
Expand All @@ -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'}
})
Expand Down
1 change: 1 addition & 0 deletions src/lib/checkbox/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/lib/chips/chip-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>, ControlValueAccessor,
Expand Down
1 change: 1 addition & 0 deletions src/lib/core/option/optgroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
1 change: 1 addition & 0 deletions src/lib/core/option/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class MdOptionSelectionChange {
},
templateUrl: 'option.html',
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MdOption {
Expand Down
1 change: 1 addition & 0 deletions src/lib/core/selection/pseudo-checkbox/pseudo-checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
1 change: 1 addition & 0 deletions src/lib/datepicker/calendar-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class MdCalendarCell {
'class': 'mat-calendar-body',
},
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MdCalendarBody {
Expand Down
1 change: 1 addition & 0 deletions src/lib/datepicker/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {MdDatepickerIntl} from './datepicker-intl';
'class': 'mat-calendar',
},
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MdCalendar<D> implements AfterContentInit, OnDestroy {
Expand Down
1 change: 1 addition & 0 deletions src/lib/datepicker/datepicker-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<D> implements OnChanges, OnDestroy {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/datepicker/datepicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<D> implements AfterContentInit {
Expand Down Expand Up @@ -120,6 +121,7 @@ export class MdDatepickerContent<D> implements AfterContentInit {
template: '',
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
})
export class MdDatepicker<D> implements OnDestroy {
/** The date to open the calendar to initially. */
Expand Down
1 change: 1 addition & 0 deletions src/lib/datepicker/month-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<D> implements AfterContentInit {
Expand Down
1 change: 1 addition & 0 deletions src/lib/datepicker/year-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<D> implements AfterContentInit {
Expand Down
1 change: 1 addition & 0 deletions src/lib/dialog/dialog-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/lib/expansion/expansion-panel-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions src/lib/expansion/expansion-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
1 change: 1 addition & 0 deletions src/lib/form-field/form-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ let nextUniqueId = 0;
'(click)': '_control.focus()',
},
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
})

Expand Down
1 change: 1 addition & 0 deletions src/lib/grid-list/grid-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 2 additions & 0 deletions src/lib/grid-list/grid-tile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
/**
Expand Down
1 change: 1 addition & 0 deletions src/lib/icon/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/list/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/list/selection-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}],
})
Expand Down Expand Up @@ -201,6 +202,7 @@ export class MdListOption extends _MdListOptionMixinBase
template: '<ng-content></ng-content>',
styleUrls: ['list.css'],
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class MdSelectionList extends _MdSelectionListMixinBase
Expand Down
1 change: 1 addition & 0 deletions src/lib/menu/menu-directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const MD_MENU_BASE_ELEVATION = 2;
styleUrls: ['menu.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
animations: [
transformMenu,
fadeInItems
Expand Down
1 change: 1 addition & 0 deletions src/lib/menu/menu-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const _MdMenuItemMixinBase = mixinDisabled(MdMenuItemBase);
},
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
preserveWhitespaces: false,
templateUrl: 'menu-item.html',
exportAs: 'mdMenuItem, matMenuItem',
})
Expand Down
Loading

0 comments on commit 2b0315d

Please sign in to comment.