File tree Expand file tree Collapse file tree
packages/component/src/providers/InjectStyleElements Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments