0

I'm trying to parse a string containing some html with tr with DOMParser but the result is not what I expected:

d = new DOMParser()
e = d.parseFromString("<tr><td>hello</td></tr>", "text/html")
<html>
  <head></head>
  <body>hello</body>
</html>

I expected it to produce a tr element in the body. What is the issue here?

fctorial
  • 765
  • 1
  • 6
  • 11

0 Answers0