Skip to content

Commit 43c1e63

Browse files
committed
replace global styles with shadow root styles
1 parent 0a68611 commit 43c1e63

File tree

2 files changed

+9
-21
lines changed

2 files changed

+9
-21
lines changed

src/component/vcf-breadcrumb.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ class VcfBreadcrumb extends ElementMixin(PolylitMixin(LitElement)) {
133133
:host(.mobile-back.is-before-current) {
134134
display: inline-block;
135135
}
136+
137+
::slotted(a.breadcrumb-anchor.add-mobile-back-icon)::before {
138+
display: inline;
139+
font-family: var(--vcf-breadcrumb-separator-font-family);
140+
content: var(--vcf-breadcrumb-mobile-back-symbol);
141+
font-size: var(--vcf-breadcrumb-separator-size);
142+
margin: var(--vcf-breadcrumb-separator-margin);
143+
color: inherit;
144+
}
136145
`];
137146
}
138147

src/component/vcf-breadcrumbs.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -342,27 +342,6 @@ export class VcfBreadcrumbs extends ResizeMixin(ElementMixin(PolylitMixin(LitEle
342342
this._mobile = matches;
343343
}),
344344
);
345-
346-
// Inject a scoped <style> element to define the mobile back icon behavior
347-
const style = document.createElement('style');
348-
style.textContent = `
349-
/*
350-
* This rule targets an <a> element with the 'breadcrumb-anchor' and
351-
* 'add-mobile-back-icon' classes that is a direct child of <vcf-breadcrumb>.
352-
*
353-
* Although technically global, it's scoped through the component selector
354-
* and only applies to breadcrumb anchors styled for mobile mode.
355-
*/
356-
vcf-breadcrumb > a.breadcrumb-anchor.add-mobile-back-icon::before {
357-
display: inline;
358-
font-family: var(--vcf-breadcrumb-separator-font-family);
359-
content: var(--vcf-breadcrumb-mobile-back-symbol);
360-
font-size: var(--vcf-breadcrumb-separator-size);
361-
margin: var(--vcf-breadcrumb-separator-margin);
362-
color: inherit;
363-
}
364-
`;
365-
this.appendChild(style);
366345
}
367346

368347
}

0 commit comments

Comments
 (0)