You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'.
The text was updated successfully, but these errors were encountered:
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'
.The text was updated successfully, but these errors were encountered: