Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!