Skip to content

Commit

Permalink
Merge pull request #4223 from albertgasset/MOBILE-4616-database
Browse files Browse the repository at this point in the history
MOBILE-4616 database: Fix specificity of custom CSS rules
  • Loading branch information
crazyserver authored Oct 23, 2024
2 parents 748559c + ab18e51 commit ae984d3
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,15 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck {
return;
}

this.componentStyles = CoreDom.prefixCSS(this.cssCode, ':host ::ng-deep', ':host');
// Prefix all CSS rules with the host attribute and [compiled-component-id].
// We need [compiled-component-id] to increase the specificity of the prefix to 0,2,0.
// This way rules added by the parent component using a class has the same base
// specificity and do not override the added rules.
this.componentStyles = CoreDom.prefixCSS(
this.cssCode,
':host([compiled-component-id]) ::ng-deep',
':host([compiled-component-id])',
);
}

/**
Expand Down

0 comments on commit ae984d3

Please sign in to comment.