File tree 1 file changed +8
-16
lines changed
src/js/packages/@reactpy/client/src
1 file changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -125,23 +125,15 @@ function ScriptElement({ model }: { model: ReactPyVdom }) {
125
125
( value ) : value is string => typeof value == "string" ,
126
126
) [ 0 ] ;
127
127
128
- let scriptElement : HTMLScriptElement ;
129
- if ( model . attributes ) {
130
- scriptElement = document . createElement ( "script" ) ;
131
- for ( const [ k , v ] of Object . entries ( model . attributes ) ) {
132
- scriptElement . setAttribute ( k , v ) ;
133
- }
134
- if ( scriptContent ) {
135
- scriptElement . appendChild ( document . createTextNode ( scriptContent ) ) ;
136
- }
137
- ref . current . appendChild ( scriptElement ) ;
138
- } else if ( scriptContent ) {
139
- const scriptResult = eval ( scriptContent ) ;
140
- if ( typeof scriptResult == "function" ) {
141
- return scriptResult ( ) ;
142
- }
128
+ const scriptElement : HTMLScriptElement = document . createElement ( "script" ) ;
129
+ for ( const [ k , v ] of Object . entries ( model . attributes || { } ) ) {
130
+ scriptElement . setAttribute ( k , v ) ;
131
+ }
132
+ if ( scriptContent ) {
133
+ scriptElement . appendChild ( document . createTextNode ( scriptContent ) ) ;
143
134
}
144
- } , [ model . key , ref . current ] ) ;
135
+ ref . current . appendChild ( scriptElement ) ;
136
+ } , [ model . key ] ) ;
145
137
146
138
return < div ref = { ref } /> ;
147
139
}
You can’t perform that action at this time.
0 commit comments