Merge pull request #1161 from esben-semmle/js/classify-mode-html

Approved by xiemaisi
This commit is contained in:
semmle-qlci
2019-03-27 12:56:04 +00:00
committed by GitHub
4 changed files with 26 additions and 0 deletions

View File

@@ -121,6 +121,23 @@ private predicate isGeneratedHtml(File f) {
e.getName() = "meta" and
e.getAttributeByName("name").getValue() = "generator"
)
or
20 < countStartingHtmlElements(f, _)
}
/**
* Gets an element that starts at line `l` in file `f`.
*/
private HTML::Element getAStartingElement(File f, int l) {
result.getFile() = f and result.getLocation().getStartLine() = l
}
/**
* Gets the number of HTML elements that start at line `l` in file `f`.
*/
private int countStartingHtmlElements(File f, int l) {
result = strictcount(getAStartingElement(f, l))
}
/**

View File

@@ -0,0 +1,4 @@
<html>
<div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
<script>42</script>
</html>

View File

@@ -1,4 +1,5 @@
| AutoRest.js:0:0:0:0 | AutoRest.js | generated |
| ManyElementsOnLine.html:0:0:0:0 | ManyElementsOnLine.html | generated |
| ai.1.2.3-build0123.js:0:0:0:0 | ai.1.2.3-build0123.js | library |
| bundle-directive.js:0:0:0:0 | bundle-directive.js | generated |
| data.js:0:0:0:0 | data.js | generated |

View File

@@ -0,0 +1,4 @@
<html>
<div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
<script>42</script>
</html>