@@ -3,11 +3,14 @@ import * as esJseshtml from 'https://esm.run/@es-js/eshtml';
33window . addEventListener ( "load" , function ( ) {
44 let etiquetas = document . getElementsByTagName ( 'script' ) ;
55 for ( var i = 0 ; i < etiquetas . length ; i ++ ) {
6- if ( etiquetas [ i ] . hasAttribute ( "type" ) && etiquetas [ i ] . getAttribute ( "type" ) == "text/esjs" ) {
6+ if ( etiquetas [ i ] . hasAttribute ( "type" ) && ( etiquetas [ i ] . getAttribute ( "type" ) == "text/esjs" || etiquetas [ i ] . getAttribute ( "type" ) == "codigo/esjs" ) ) {
77 try {
88 let codigoCom = esJscore . compile ( etiquetas [ i ] . innerHTML ) ;
99 let elemento = document . createElement ( "script" ) ;
1010 elemento . innerHTML = codigoCom ;
11+ if ( etiquetas [ i ] . hasAttribute ( "mode" ) && etiquetas [ i ] . getAttribute ( "mode" ) == "modulo" ) {
12+ elemento . setAttribute ( "type" , "module" ) ;
13+ }
1114 document . body . appendChild ( elemento ) ;
1215 } catch ( error ) {
1316 console . error ( error ) ;
@@ -18,6 +21,9 @@ window.addEventListener("load", function(){
1821 let codigoCo2m = esJscore . compile ( data ) ;
1922 let element2o = document . createElement ( "script" ) ;
2023 element2o . innerHTML = codigoCo2m ;
24+ if ( estiquetas [ i ] . hasAttribute ( "mode" ) && etiquetas [ i ] . getAttribute ( "mode" ) == "modulo" ) {
25+ elemento . setAttribute ( "type" , "module" ) ;
26+ }
2127 document . body . appendChild ( elemento ) ;
2228 } ) . catch ( function ( error ) {
2329 console . error ( error ) ;
@@ -30,7 +36,7 @@ window.addEventListener("load", function(){
3036 }
3137 let etiquetasH = document . getElementsByTagName ( "div" ) ;
3238 for ( var u = 0 ; u < etiquetasH . length ; u ++ ) {
33- if ( etiquetasH [ u ] . hasAttribute ( "type" ) && etiquetasH [ u ] . getAttribute ( "type" ) == "text/eshtml" ) {
39+ if ( etiquetasH [ u ] . hasAttribute ( "type" ) && ( etiquetasH [ u ] . getAttribute ( "type" ) == "text/eshtml" || etiquetasH [ u ] . getAttribute ( "type" ) == "codigo/eshtml" ) ) {
3440 try {
3541 etiquetasH [ u ] . innerHTML = esJseshtml . compile ( etiquetasH [ u ] . innerHTML ) ;
3642 } catch ( error ) {
0 commit comments