New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not all valid attribute names can be parsed #252
Comments
We also need to decide whether there should be a different behavior for XML vs HTML. Contributions to resolve this are of course welcome, either by discussing details here or (after the resolution of 203!) by providing a PR including tests. |
So, to add additional context to this, the mentioned Namespaces in XML Recommendation introduces a new concept known as “namespace-well-formed” which requires element and attribute names to match the Because XML parsing for the DOM is namespace‐aware, documents need to be namespace‐well‐formed in addition to just being ordinarily well‐formed. So it should produce an error when parsing as XML. HTML’s rules have been made considerably more lax in order to support |
@marrus-sh Thank you, that was very helpful. I updated my last comment accordingly. |
It also appears that there is a problem with the attribute "constructor" also. Here is an example element with that attribute that it is failing on: <java:new doc:name="Get date instance" doc:id="f5784e1d-4a0d-428f-9833-9f33694bbf10" class="java.util.Date" constructor="Date()" target="dateVar"/> |
This appears to be because the attributes are stored on an ordinary empty object To fix this, one of the following approaches can be taken:
|
Interesting finding and thx a lot for tge investigation. This also means the issue about |
As noted in issue xmldom#252 some attributes conflict with prototype fields (such as an attribute `constructor`) thus we must remove the `in` operator and replace with `Object.prototype.hasOwnProperty()`.
FYI: The issue regarding attribute names conflicting with the prototype chain was solved and released as 0.7.4 |
This is a continuation of jindw/xmldom#267 which already contains an elaborate discussion.
Two examples that are used in vue, are attributes starting with
:
or@
.According to the XML 1.1 spec https://www.w3.org/TR/xml11/#sec-common-syn:
But according to the latest HTML spec, in which namespaces are not something to consider, the definition of what is allowed in attribute names is different: https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
The text was updated successfully, but these errors were encountered: