domparser parse email link not correct
Categories
(Firefox :: Untriaged, defect)
Tracking
()
People
(Reporter: deju.tu, Unassigned)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Steps to reproduce:
var text = `<div>
Email: <a href="mailto:clientservices@tigerbrokers.nz?subject=Hello&body=Your%20opinion" style="color: #707070;">clientservices@tigerbrokers.nz</a>
</div>`;
var domParser = new DOMParser();
var dom = domParser.parseFromString(text, 'text/xml');
Actual results:
run script above and then got error: XML Parsing Error: not well-formed. It is success when remove &body=Your%20opinion.
Expected results:
run success.
Comment 1•3 years ago
|
||
Where exactly should I run this script to work?
Thanks.
(In reply to Hani Yacoub from comment #1)
Where exactly should I run this script to work?
Thanks.
please look the attached image. The script would not throw the error in other browsers.
Comment 5•3 years ago
|
||
The ampersand needs to be escaped to be valid XML. https://stackoverflow.com/questions/53008615/why-is-the-ampersand-an-invalid-character-in-xml. You probably actually want to parse as HTML so change text/xml to text/html.
Description
•