File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -11,14 +11,17 @@ export const jsonToCss = (stylesheet: object) => {
11
11
12
12
export const injectStyles = ( cssText : string ) => {
13
13
/** Inject the given `cssText` in the document head */
14
- const style = document . createElement ( "style" ) ;
15
- style . setAttribute ( "type" , "text/css" ) ;
14
+ try {
15
+ const style = document . createElement ( "style" ) ;
16
+ style . setAttribute ( "type" , "text/css" ) ;
16
17
17
- if ( ( style as any ) . styleSheet ) {
18
- ( style as any ) . styleSheet . cssText = cssText ;
19
- } else {
20
- style . appendChild ( document . createTextNode ( cssText ) ) ;
21
- }
18
+ if ( ( style as any ) . styleSheet ) {
19
+ ( style as any ) . styleSheet . cssText = cssText ;
20
+ } else {
21
+ style . appendChild ( document . createTextNode ( cssText ) ) ;
22
+ }
22
23
23
- document . head . appendChild ( style ) ;
24
+ document . head . appendChild ( style ) ;
25
+ } catch ( err ) {
26
+ }
24
27
}
You can’t perform that action at this time.
0 commit comments