开发者

JEditorPane is discarding empty elements

The following test fails with JRE 1.6.0_20

public void testSetGetTextWithList() throws Exception {
    final JEditorPane editorPane = new JEditorPane();
    editorPane.setContentType("text/html");
    editorPane.setText("<ul><li></li></ul>");
    assertTrue(editorPane.getText().contains("<ul"));
}

Of course, there is a visual difference between an empty list and a non-existing list, so I expect the editor not to discard the emp开发者_Python百科ty list. Anybody with an easy solution for this problem?


The error occurs only if the element is the last block element in the document, the test passes if you change the input to one of

<ul><li></li></ul>a
<ul><li></li></ul><p></p>
<ul><li></li></ul>&nbsp;
<ul><li></li></ul><!---->
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜