Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

179
Vistas
Adding attribute containing an illegal character @ to DOM

Context

I am in a situation in which I want to re-render some existing HTML using javascript. The server side is not under my control, I cannot apply any changes to the HTML document I am working on, I have to work fully client-side.

I would like to leverage vue functionality, using petite-vue. In order to do that, I plan to manipulate the DOM and add the vue directives to the DOM nodes in a preparation script. After that script is done, I want to mount the vue application.

Question

One problem with this approach is that some vue directives have illegal characters. For instance, on a certain element, I want to set an attribute Attr("@vue:mounted", "mounted()"). This raises a DOMException, because @vue:mounted is not a valid XML-Name (due to the starting @) which is a requirement for DOM attribute names.

How can I set this attribute so that vue is going to accept it? I think that vue somehow works around the illegal character, as it somehow manages to read the attribute. But I am not familiar with the internals of vue. Maybe there is also an way to achieve what I want without knowing the internals of vue, but I don't know how to do that either.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In Vue the @ character (in templates) is just a shorthand for v-on:. And as petit-vue should be compatible in this regard, you can try to use Attr("v-on:vue:mounted", "mounted()") instead...

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda