JS: isAngularTemplateAttributeName

This commit is contained in:
Asger Feldthaus
2020-12-10 14:35:06 +00:00
parent ed27c8b13f
commit 9b99f56d44

View File

@@ -93,7 +93,7 @@ public class HTMLExtractor implements IExtractor {
String source = attr.getValue();
RowColumnVector valueStart = attr.getValueSegment().getRowColumnVector();
if (JS_ATTRIBUTE.matcher(attr.getName()).matches()) {
if (JS_ATTRIBUTE.matcher(attr.getName()).matches() || isAngularTemplateAttributeName(attr.getName())) {
snippetLoC =
extractSnippet(
2,
@@ -128,6 +128,12 @@ public class HTMLExtractor implements IExtractor {
}
}
private boolean isAngularTemplateAttributeName(String name) {
return name.startsWith("[") && name.endsWith("]") ||
name.startsWith("(") && name.endsWith(")") ||
name.startsWith("*ng");
}
/** List of HTML attributes whose value is interpreted as JavaScript. */
private static final Pattern JS_ATTRIBUTE =
Pattern.compile(