IHTMLDocument2 write无法正确处理IHTMLStyleSheet中的样式名称有解决方案吗?

问题描述

请在下面查看此html。将其输入IHTMLDocument2.write。现在,通过get_styleSheets提取标题样式。令人惊讶的是,IHTMLStyleSheet.get_csstext返回2个TR.green条目,即

TR.hometown {BACKGROUND: yellow}
TR.green {BACKGROUND: green}
TR.green {BACKGROUND: #ff0000}

与输入的html不同。 除了自己解析html之外,还有其他解决方法吗:-(?

<html><head><style>
tr.hometown { background: yellow; }
tr.hometown.green { background: green;}
tr.green{background: #ff0000;}
</style></head><body><table>
<tr class="green"><td><p>Red background.</p></td></tr>
<tr class="hometown green"><td><p>green background.</p></td></tr>
<tr><td><p>normal text.</p></td></tr>
<tr class="hometown"><td><p>yellow background.</p></td></tr>
<tr><td><h1 class="hometown">header 1 text</h1></td></tr>
</table></body></html>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)