WebReflection / WebReflection/linkedom
Characters (<) and (>) escaped incorrectly in xml attributes
Open
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 2.1k
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Description
For XML document :
The left angle bracket (<) MUST NOT appear in their literal form,
[...] they MUST be escaped using [...] the string <".
The right angle bracket (>) [...] MUST be escaped using ">"
Full source : https://www.w3.org/TR/xml11/#syntax
Test snippet:
const document = (new DOMParser).parseFromString('<root attr="<>"></root>', 'text/xml');
assert(document.toString(), '<?xml version="1.0" encoding="utf-8"?><root attr="<>" />');
Expected: <?xml version="1.0" encoding="utf-8"?><root attr="<>" />
Got instead: <?xml version="1.0" encoding="utf-8"?><root attr="<>" />
Note :
- The
HTMLparser must not changed and does not have the same behavior - Only the
.toStringfunction must escaped, thegetAttribute("attr")must continue to provide unescaped characters (<) and (>)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the DOMParser and XML toString behavior shown in the supplied test snippet, reproducing it first. Done means XML serialization escapes angle brackets in attribute values, getAttribute("attr") still returns unescaped characters, and HTML parsing remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, xml
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100