Check if anchor has content

This commit is contained in:
M66B 2020-09-12 12:19:34 +02:00
parent e111f8fec5
commit 7014a7e0d7
1 changed files with 8 additions and 4 deletions

View File

@ -1310,10 +1310,14 @@ public class HtmlHelper {
return true; return true;
else if (node instanceof Element) { else if (node instanceof Element) {
Element element = (Element) node; Element element = (Element) node;
if (!element.isBlock() && if (element.isBlock())
(element.hasText() || return false;
element.selectFirst("a[href~=.+]") != null || if (element.hasText())
element.selectFirst("img[src~=.+]") != null)) return true;
if (element.selectFirst("img[src~=.+]") != null)
return true;
for (Element a : element.select("a[href~=.+]"))
if (a.childNodes().size() > 0)
return true; return true;
} }
return false; return false;