Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b99f56

Browse files
committed
JS: isAngularTemplateAttributeName
1 parent ed27c8b commit 9b99f56

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

javascript/extractor/src/com/semmle/js/extractor/HTMLExtractor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void handleElement(Element elt) {
9393

9494
String source = attr.getValue();
9595
RowColumnVector valueStart = attr.getValueSegment().getRowColumnVector();
96-
if (JS_ATTRIBUTE.matcher(attr.getName()).matches()) {
96+
if (JS_ATTRIBUTE.matcher(attr.getName()).matches() || isAngularTemplateAttributeName(attr.getName())) {
9797
snippetLoC =
9898
extractSnippet(
9999
2,
@@ -128,6 +128,12 @@ public LoCInfo getLoCInfo() {
128128
}
129129
}
130130

131+
private boolean isAngularTemplateAttributeName(String name) {
132+
return name.startsWith("[") && name.endsWith("]") ||
133+
name.startsWith("(") && name.endsWith(")") ||
134+
name.startsWith("*ng");
135+
}
136+
131137
/** List of HTML attributes whose value is interpreted as JavaScript. */
132138
private static final Pattern JS_ATTRIBUTE =
133139
Pattern.compile(

0 commit comments

Comments
 (0)