Scenario
I find myself needing to update some existing HTML using JavaScript, but I'm limited in that the server side is out of my control. This means that any changes must be made client-side only without altering the original HTML document.
To accomplish this task, I want to utilize vue functionality with petite-vue
. My plan is to manipulate the DOM and add vue directives through a preparation script before mounting the vue application.
Inquiry
An obstacle I've encountered involves working with certain vue directives containing illegal characters. For example, attempting to set an attribute like
Attr("@vue:mounted", "mounted()")
results in a DOMException
, as attributes such as @vue:mounted
fail to meet the criteria for valid XML names due to the presence of special characters.
How can I work around this issue so that vue will accept the attribute? While vue seems able to handle these characters internally, I'm unsure of how it accomplishes this. Is there a method to achieve the desired outcome without delving into vue's internal workings? Any guidance would be much appreciated.