Skip to content

Commit 1a74333

Browse files
committed
Add comment
1 parent a741a60 commit 1a74333

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

packages/component/src/providers/InjectStyleElements/InjectStyleElementsComposer.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,23 @@ function InjectStyleElementsComposer(props: InjectStyleElementsComposerProps) {
6767
// When appending via useEffect(), the order of the useEffect() call will be from descendants to ancestors.
6868
// That means, the order will be reverse of what is in the React tree.
6969
// We are doing prepend instead of append, while keeping the first node the last one in the root element.
70+
71+
// ```html
72+
// <InjectStyleElementsComposer styleElements={[stylesA1, stylesA2]}>
73+
// <InjectStyleElementsComposer styleElements={[stylesB]} />
74+
// </InjectStyleElementsComposer>
75+
// ```
76+
77+
// Will be injected in the following order to honor CSS cascading:
78+
79+
// ```html
80+
// <head>
81+
// <style>... stylesA1 ...</style>
82+
// <style>... stylesA2 ...</style>
83+
// <style>... stylesB ...</style>
84+
// </head>
85+
// ```
86+
7087
const insertBeforeNode = Array.from(root.childNodes).find(
7188
child => child instanceof HTMLElement && child.hasAttribute('data-webchat-injected')
7289
);

0 commit comments

Comments
 (0)