Skip to content

perf(list): reduce css selector size #12571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/lib/list/_list-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$background: map-get($theme, background);
$foreground: map-get($theme, foreground);

.mat-list, .mat-nav-list, .mat-selection-list {
.mat-list-base {
.mat-list-item {
color: mat-color($foreground, text);
}
Expand Down Expand Up @@ -46,7 +46,7 @@
}

// Default list
.mat-list, .mat-nav-list, .mat-selection-list {
.mat-list-base {
.mat-list-item {
font-size: mat-font-size($config, subheading-2);
@include mat-line-base(mat-font-size($config, body-1));
Expand All @@ -65,7 +65,7 @@
}

// Dense list
.mat-list[dense], .mat-nav-list[dense], .mat-selection-list[dense] {
.mat-list-base[dense] {
.mat-list-item {
font-size: mat-font-size($config, caption);
@include mat-line-base(mat-font-size($config, caption));
Expand Down
10 changes: 3 additions & 7 deletions src/lib/list/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,7 @@ $mat-list-item-inset-divider-offset: 72px;

// This needs slightly more specificity, because it
// can be overwritten by the typography styles.
.mat-list &,
.mat-nav-list &,
.mat-selection-list & {
.mat-list-base & {
margin: 0;
}
}
Expand All @@ -206,7 +204,7 @@ $mat-list-item-inset-divider-offset: 72px;
}
}

.mat-list, .mat-nav-list, .mat-selection-list {
.mat-list-base {
padding-top: $mat-list-top-padding;
display: block;
-webkit-tap-highlight-color: transparent;
Expand All @@ -229,9 +227,7 @@ $mat-list-item-inset-divider-offset: 72px;
}


.mat-list[dense],
.mat-nav-list[dense],
.mat-selection-list[dense] {
.mat-list-base[dense] {
padding-top: $mat-dense-top-padding;
display: block;

Expand Down
6 changes: 4 additions & 2 deletions src/lib/list/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const _MatListItemMixinBase = mixinDisableRipple(MatListItemBase);
exportAs: 'matNavList',
host: {
'role': 'navigation',
'class': 'mat-nav-list'
'class': 'mat-nav-list mat-list-base'
},
templateUrl: 'list.html',
styleUrls: ['list.css'],
Expand All @@ -51,7 +51,9 @@ export class MatNavList extends _MatListMixinBase implements CanDisableRipple {}
selector: 'mat-list',
exportAs: 'matList',
templateUrl: 'list.html',
host: {'class': 'mat-list'},
host: {
'class': 'mat-list mat-list-base'
},
styleUrls: ['list.css'],
inputs: ['disableRipple'],
encapsulation: ViewEncapsulation.None,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/list/selection-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export class MatListOption extends _MatListOptionMixinBase
host: {
'role': 'listbox',
'[tabIndex]': 'tabIndex',
'class': 'mat-selection-list',
'class': 'mat-selection-list mat-list-base',
'(focus)': 'focus()',
'(blur)': '_onTouched()',
'(keydown)': '_keydown($event)',
Expand Down