Merge pull request #4223 from albertgasset/MOBILE-4616-database

MOBILE-4616 database: Fix specificity of custom CSS rules
main
Pau Ferrer Ocaña 2024-10-23 15:31:43 +02:00 committed by GitHub
commit ae984d3a67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -202,7 +202,15 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck {
return; 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])',
);
} }
/** /**