Skip to content

Commit

Permalink
fix(runtime): fix NotFoundError in addStyle function with referenceNo…
Browse files Browse the repository at this point in the history
…de parent check (#6107)

      Co-authored-by: huseyin.beyan <[email protected]>
  • Loading branch information
hbeyan authored Jan 25, 2025
1 parent 1e8a2d2 commit 26ceed6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/runtime/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ export const addStyle = (styleContainerNode: any, cmpMeta: d.ComponentRuntimeMet
preconnectLinks.length > 0
? preconnectLinks[preconnectLinks.length - 1].nextSibling
: styleContainerNode.querySelector('style');
(styleContainerNode as HTMLElement).insertBefore(styleElm, referenceNode);
(styleContainerNode as HTMLElement).insertBefore(
styleElm,
referenceNode?.parentNode === styleContainerNode ? referenceNode : null,
);
} else if ('host' in styleContainerNode) {
if (supportsConstructableStylesheets) {
/**
Expand Down

0 comments on commit 26ceed6

Please sign in to comment.