JS modular pattern does not work on Edge

1

I am in a development to which I applied the modular Javascript pattern to have the most tedious and scalable code and I am having problems with MS Edge. In Chrome and Firefox it's perfect. I pass part of the code:

HTML

let globals={base_url: "..."};

var Garantia = (function () {
            
            var url = {
              validarCapitalGarantizado: globals.base_url+"/validarCapitalGarantizado",
              getCuit : globals.base_url+"/obtenerGarantiasPorCUITyEfi/"
            }
        
            var elements = {
                selectDestino: $("#select-destino"),
                selectSistema: $("#select-sistema"),
                selectFecuencia: $("#select-frecuencia-amortizacion"),
                selectOperacion: $("#tipo-operacion"),
                tasaInteres: $('#tasa-interes'),
                plazoTotal: $("#plazo-total"),
                cuit: $('#cuit'),
                efi: $('#efi'),
                form: $('form'),
                montoGarantizado: $('#monto-garantizado'),
                montoTotal: $('#monto-total'),
                fechaAcreditacion: $("#fecha-acreditacion"),
                tipoOperacion: $("#tipo-operacion"),
                garantiasVinculadas: $('#garantias-vinculadas'),
                optionRefinanciacion: $("#tipo-operacion [value= 'r']")
            }
        
            var hiddenElements = {
                montoMaximo: $('#montoMaximo'),
                garantiasActuales: $('#garantiasActuales'),
                montoMaximoGarantias: $('#maxGarantias')
            }
        
            //----- Private Methods --------
            var suscribeEvents = function(){
        
                elements.form.on('submit', events.submit);
                elements.montoGarantizado.on('change', events.validarMontos);
                elements.montoTotal.on('change', events.validarMontos);
                elements.cuit.on('change', events.getMontosMaximos);
                elements.cuit.on('change', events.cargarGarantiasCuit);
                elements.fechaAcreditacion.on('change', events.validarAcreditacionYPlazo);
                elements.plazoTotal.on('change', events.validarAcreditacionYPlazo);
                elements.tipoOperacion.on('change',events.toggleRefinanciacion);
            };
        
            var events = {
    submit: function(e) {
                if (!validaciones()){
                    return false;         
                } 
                elements.form.submit();
            },
            validarMontos: function(e){
                calculoPorcentajeYGarantizado();
            },
            getMontosMaximos:function(e){
                getMontosMaximos();
            },
            validarAcreditacionYPlazo: function(e){
                validarAcreditacionYPlazo(e);
            },
            toggleRefinanciacion: function(e){
                if (elements.tipoOperacion.val() == 'r') {
                   elements.garantiasVinculadas.prop('disabled',false);
                } else {
                   elements.garantiasVinculadas.prop('disabled',true);
                }
            },
            cargarGarantiasCuit: function(e){
                cargarGarantiasCuit();
            }
            };
        
            //carga los id de garantias vinculadas al cuit en el select.
            var cargarGarantiasCuit = function(){
        
            }
        
            var validarAcreditacionYPlazo = function(e){
                
            }
        
            var calculoPorcentajeYGarantizado = function(){
               
            }
        
            //validaciones de frmulario
            var validaciones = function(){
                return true;
            }
        
            var getMontosMaximos = function(){
        
            }
        
            var getPriceAsFloat = function(id){
            }
        
            //----- Public methods --------
            //inicializa el objeto
            var initialize = function(e){
                suscribeEvents();
                elements.optionRefinanciacion.prop('disabled',true);
                elements.garantiasVinculadas.prop('disabled',true)
            }
        
            //----- Public API --------
              return {
                init: initialize,
                getMontosMaximos: getMontosMaximos,
                validaciones: validaciones
              }
        }());
        
        Garantia.init();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="col-sm-4">
  <div class="form-group">
    <label for="cuit">CUIT</label>
    <input class="form-control"
    type="text"
    name="cuit"
    id="cuit"
    required>
  </div>
</div>
<!-- -->
<div class="col-sm-4">
  <div class="form-group">
    <label for="fecha-acreditacion">Fecha de acreditación del préstamo:</label>
    <input class="form-control calendar"
    type="text"
    name="fechaAcreditacionPrestamo"
    id="fecha-acreditacion"
    >
  </div>
</div>
<!-- -->
<div class="col-sm-4">
  <div class="form-group">
    <label for="fecha-primer-vencimiento">Fecha del primer vencimiento:</label>
    <input class="form-control calendar"
    type="text"
    name="fechaPrimerVencimiento"
    id="fecha-primer-vencimiento"
    placeholder="Primer vencimiento de amortización del capital"
    >
  </div>
</div>
<!-- -->
<div class="col-sm-4">
  <div class="form-group">
    <label for="monto-total">Monto total prestamo:</label>
    <input class="form-control price"
    type="text"
    name="montoTotalCredito"
    id="monto-total"
    required >
  </div>
</div>
<!-- -->
<div class="col-sm-4">
  <div class="form-group">
    <label for="monto-garantizado">Monto Garantizado:</label>
    <input class="form-control price"
    type="text"
    name="montoGarantizado"
    id="monto-garantizado"
    required >
  </div>
</div>
<!-- -->

The "Object" of JS that interacts with that part of the HTML:

I did not put the bodies of the methods because they are long. Finally, in Edge I put Breakpoints within the methods and it never arrives (If the Init and the subscribeEvents are executed). That is, the event is not being associated with the elements. Any idea what it can be?

PS: Syntax errors do not appear in the console. This is working in Chrome, is something that Edge does not support?

    
asked by Fer 13.04.2018 в 03:41
source

0 answers