Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.2, 6.2.3, 6.2.4, 6.3.0
-
None
Description
if the html contains stylesheet or script .
QTextDocumentFragment::fromHtml can not work .
the expected `size >0`
QString t="<div class=\"mdict\"><link rel=\"stylesheet\" href=\"a.css\"><h2><a>advice</a>:建议</h2><p>同advise.与advise的区别主要是后期语言学者人为的影响</p></div>"; int size = QTextDocumentFragment::fromHtml( t ).toPlainText().length();
expected size>0
actual result : size=0;
the following html contain script node .
QTextDocumentFragment::fromHtml( t ).toPlainText() does not work neither.
QString t="<div class=\"mdict\"><head><script src=\"a.js\" charset=\"utf-8\" type=\"text/javascript\" language=\"javascript\"></script></head>test</div>";
remove stylesheet .the html can work normally.
QString t="<div class=\"mdict\"><h2><a>advice</a>:建议</h2><p>同advise.与advise的区别主要是后期语言学者人为的影响</p></div>";
see attachment.
another issue:
if the html is
QString t="<div><z>down</z><z>load</z></div>";
auto size = QTextDocumentFragment::fromHtml( t ).toPlainText();
the expected result is : down load
the actual result is : download