File tree Expand file tree Collapse file tree 1 file changed +8
-16
lines changed
src/js/packages/@reactpy/client/src Expand file tree Collapse file tree 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 }) {
125125 ( value ) : value is string => typeof value == "string" ,
126126 ) [ 0 ] ;
127127
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 ) ) ;
143134 }
144- } , [ model . key , ref . current ] ) ;
135+ ref . current . appendChild ( scriptElement ) ;
136+ } , [ model . key ] ) ;
145137
146138 return < div ref = { ref } /> ;
147139}
You can’t perform that action at this time.
0 commit comments