File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 11{
2- "version" : " 0.1.8 " ,
2+ "version" : " 0.1.9 " ,
33 "name" : " react-phone-hooks" ,
44 "description" : " React hooks and utility functions for parsing and validating phone numbers." ,
55 "keywords" : [
Original file line number Diff line number Diff line change @@ -11,14 +11,17 @@ export const jsonToCss = (stylesheet: object) => {
1111
1212export const injectStyles = ( cssText : string ) => {
1313 /** 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" ) ;
1617
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+ }
2223
23- document . head . appendChild ( style ) ;
24+ document . head . appendChild ( style ) ;
25+ } catch ( err ) {
26+ }
2427}
You can’t perform that action at this time.
0 commit comments