Closed Bug 1776161 Opened 3 years ago Closed 3 years ago

domparser parse email link not correct

Categories

(Firefox :: Untriaged, defect)

Firefox 101
defect

Tracking

()

RESOLVED INVALID

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.

Where exactly should I run this script to work?
Thanks.

Flags: needinfo?(deju.tu)
Attached image throw error
Flags: needinfo?(deju.tu)

(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.

Attached image version of browser

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.

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: