我正在使用 JSoup 来清理一些不受信任的 HTML。我发现如果我打电话
String html = "<div id='foo'><script type='text/javascript'>alert('hello');</script></div>";
String cleanedHtml = Jsoup.clean(html, Whitelist.relaxed());
此时cleanedHtml是
<div><div>
所以<script>标签已被正确删除,但神秘的id是,<div>. 有什么好的理由应该删除它还是一个错误?