Javascript DOMParser的行为异常

Javascript DOMParser的行为异常,javascript,jquery,html,domparser,Javascript,Jquery,Html,Domparser,这篇文章与 我有以下DOM字符串 <DIV STYLE="text-align:Left;font-family:Segoe UI;font-style:normal;font-weight:normal;font-size:12;color:#000000;"> <P STYLE="margin:0 0 0 0;"> <SPAN><SPAN>Lee is an attentive listener who tunes into the task

这篇文章与

我有以下DOM字符串

<DIV STYLE="text-align:Left;font-family:Segoe UI;font-style:normal;font-weight:normal;font-size:12;color:#000000;">
<P STYLE="margin:0 0 0 0;">
<SPAN><SPAN>Lee  is an attentive listener who tunes into the task at hand and follows instructions. 
</SPAN></SPAN></P><P />
<P STYLE="margin:0 0 0 0;">
<SPAN>
<SPAN>In our reading lessons we have been working on books from Levels 6 to 9 with support given as needed. 
</SPAN></SPAN></P><P />
<P STYLE="margin:0 0 0 0;">
<SPAN>
<SPAN>Lee can write his own simple stories and recounts of 2 or 3 sentences. 
</SPAN></SPAN></P><P />
</Div>
doc.firstChild.children.length为7

文件firstChild.children.item(0)作为

doc.firstChild.children.item(1)为空

文件firstChild.children.item(2)作为

文件firstChild.children.item(4)作为

所有其他项均为空

此外,上述所有7个孩子都有一个nodeNamep

这对我来说真的没有意义

此外,当我将段落附加到表格单元格时,段落之间没有间距

$(".test").get(elementPos).appendChild(doc.firstChild);
文档创建如下(替换为上述DOM字符串…)
你没有说出你期望的,你也没有展示
doc
是如何创建的(你说的是DOMParser,但看起来你肯定不是在使用DOMParser,因为DOMParser会导致doc.firstChild.childrence.length=2(head和body是两个元素)我希望有我的文字段落,也提到如果我添加和文本,它应该显示为粗体和斜体,现在在我的文章中也提到了文档创建
Lee  is an attentive listener who tunes into the task at hand and follows instructions
 In our reading lessons we have been working on books from Levels 6 to 9 with support given as needed.
Lee can write his own simple stories and recounts of 2 or 3 sentences. 
$(".test").get(elementPos).appendChild(doc.firstChild);
  var parser = new DOMParser();    
  var doc = parser.parseFromString(replaced, "text/xml");