Check for CSS styles

This commit is contained in:
M66B 2022-11-17 07:58:17 +01:00
parent c7fd8f1f12
commit 1ed45c4d1c
1 changed files with 21 additions and 0 deletions

View File

@ -2588,6 +2588,27 @@ public class HtmlHelper {
if (node instanceof Element) {
Element e = (Element) node;
String style = e.attr("style");
if (!TextUtils.isEmpty(style)) {
String[] params = style.split(";");
for (String param : params) {
int colon = param.indexOf(':');
if (colon <= 0)
continue;
String key = param.substring(0, colon).trim();
if ("color".equalsIgnoreCase(key) ||
"background-color".equalsIgnoreCase(key) ||
"font-family".equalsIgnoreCase(key) ||
"font-size".equalsIgnoreCase(key) ||
"text-align".equalsIgnoreCase(key) ||
"text-decoration".equalsIgnoreCase(key) /* line-through */) {
Log.i("Style element=" + node + " style=" + style);
result.value = true;
return FilterResult.STOP;
}
}
}
if (STRUCTURE.contains(e.tagName()))
return FilterResult.CONTINUE;