Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
missing : after property id when minifying with yuicompressor

I have to call an external app on my website with:

  const { toggle  } = window.cdn.createAnimation('Ff8rx6E4'); 
  document.querySelector('#btn-mobile-openapp').onclick = toggle;

This works surprisingly ok. But when I am trying to minify the file, it runs a js validity check and I am getting:

missing : after property id

The regular onclick or eventlisteners won't work here. Any ideas how to correctly define toggle without running into an error?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

This looks to me like the minifier isn't aware of destructuring. Try switching the JavaScript to

  const animation = window.cdn.createAnimation('Ff8rx6E4'); 
  document.querySelector('#btn-mobile-openapp').onclick = animation.toggle;

Or there could be some invisible character in your { toggle }? I can see 2 spaces before the closing }.

Failing that, what are you using to minify?

about 4 years ago · Juan Pablo Isaza Relatório

0

This JavaScript exception missing : after property id occurs if objects are declared using the object’s initialization syntax. It can happen when there is a mistake in the object initializer syntax somewhere. Might be in fact a missing curly bracket, but could also be a missing comma.

In your case, since it's only occuring in minification and by looking at your code, try to use it in a regular assignment instead of the object destructuring way which might be the cause for the error.

const animate = window.cdn.createAnimation('Ff8rx6E4'); 
document.querySelector('#btn-mobile-openapp').onclick = animate.toggle;
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda