<br/>没有正确渲染

时间:2013-06-22 09:34:38

标签: javascript html dom

我通过Socket.io加载数据,然后将其包装在一些HTML中,然后用DOMParser解析它,将其添加到我的容器中,但<br>被忽略。

这是容器:

Container

虽然这是源代码

<div webm-query="Lina.httpd.Access" webm-display="<span>%v</span><br />">
<span>212.142.132.240: GET / HTTP/1.1 -> 200</span><br></br>
<span>212.142.132.240: GET / HTTP/1.1 -> 200</span><br></br>
<span>212.142.132.240: GET / HTTP/1.1 -> 200</span><br></br>
<span>212.142.132.240: GET / HTTP/1.1 -> 200</span><br></br>
<span>212.142.132.240: GET / HTTP/1.1 -> 200</span><br></br>
<span>212.142.132.240: GET / HTTP/1.1 -> 200</span><br></br>
<span>212.142.132.240: GET / HTTP/1.1 -> 200</span><br></br>
<span>212.142.132.240: GET / HTTP/1.1 -> 200</span><br></br>
<span>212.142.132.240: GET / HTTP/1.1 -> 200</span><br></br>
<span>212.142.132.240: GET / HTTP/1.1 -> 200</span><br></br>
<span>212.142.132.240: GET / HTTP/1.1 -> 200</span><br></br>
<span>212.142.132.240: GET / HTTP/1.1 -> 200</span><br></br>
</div>

通过

生成
var data = ((Properties.Modifier && webm.Modifier[Properties.Modifier]) ?
                webm.Modifier[Properties.Modifier](Data) : Data);
var html = (Properties.Display) ? "<div>"+replaceAll("'", "\"", replaceAll("%k", Query, replaceAll("%v",data, roperties.Display)))+"</div>" :data;
return htmlString = (Properties.Display) ? new DOMParser().parseFromString(html, "text/xml") : data;

1 个答案:

答案 0 :(得分:1)

我相信<br>代码是自我关闭的,所以你不应该<br></br>但应该<br />