parseFromString() ignore all the content before first <br/>Β #261
Open
Description
I'm using the following line
const doc = new DOMParser().parseFromString(html, 'text/html');
and realize
if html = '1<br/>2',
the result doc only contains '<br/>2'
.
if html = '1<br/>2<br/>3'
, the result doc only contains '<br/>2<br/>3'
.
Seems like if <br/>
is the first tag, then any text content before the first <br/>
is ignored.
Notice if you have some tag wrap that text content it can maintain (In other words, <br/>
is not the first tag any more)
if html = '<b>1</b><br/>2',
the result doc is '<b>1</b><br/>2'
.
Metadata
Assignees
Labels
No labels