Problems parsing html tags using DOMParser and parseFromString

377 views Asked by At

Problem while parsing HTML using DOMParser.

As shown in the example, even if an unusual HTML tag was entered, it was filled with insufficient tags inside the DOMParser and parsed them back.

 var parser = new DOMParser();
var stringContainingHTMLSource = '<table><tr><td><table</tr></td></td></tr>/table';
var doc = parser.parseFromString(stringContainingHTMLSource, "text/html");
console.log(doc);

I haven't found a reference to this as a normal feature, and I don't know if I can trust it to write a program.

Can anyone give you a reference to the features of DOMParser?

0

There are 0 answers