Skip to content

Commit

Permalink
fix(ld-icon): make sure shadow dom style element is not removed
Browse files Browse the repository at this point in the history
Resolves #124
  • Loading branch information
borisdiakur committed Nov 20, 2021
1 parent 982a509 commit 7cb5746
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/liquid/components/ld-icon/ld-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,15 @@ export class LdIcon {
const div = document.createElement('div')
const iconString = await fetchIcon(this.name)

div.innerHTML = iconString.replace('<svg', '<svg part="icon"')
this.element.shadowRoot.innerHTML = ''
div.innerHTML = iconString.replace(
'<svg',
'<svg class="ld-icon__svg" part="icon"'
)
Array.from(this.element.shadowRoot.children).forEach((child) => {
if (child.tagName !== 'STYLE') {
this.element.shadowRoot.removeChild(child)
}
})
this.element.shadowRoot.appendChild(div.firstChild)
}

Expand Down
2 changes: 2 additions & 0 deletions src/liquid/components/ld-tabs/ld-tab/ld-tab.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
min-height: var(--ld-tab-min-height);
color: var(--ld-tab-text-col);
background-color: var(--ld-tab-bg-col);
box-sizing: border-box;
margin: 0;

&[aria-disabled='true'] {
color: var(--ld-tab-disabled-text-col);
Expand Down

0 comments on commit 7cb5746

Please sign in to comment.