Skip to content

Commit

Permalink
Fix a false JSError reported by Phantomas (macbre#1296)
Browse files Browse the repository at this point in the history
Co-authored-by: Maciej Brencz <[email protected]>
  • Loading branch information
gmetais and macbre committed Aug 13, 2023
1 parent 3991c1f commit 34823d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/domQueries/scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
var context = phantomas.getDOMPath(this);

// querying by BODY and body is the same (issue #419)
tagName = tagName.toLowerCase();
if (tagName) tagName = tagName.toLowerCase();

phantomas.incrMetric("DOMqueriesByTagName");
phantomas.addOffender("DOMqueriesByTagName", {
Expand Down
7 changes: 7 additions & 0 deletions test/webroot/js-errors.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@
// and this one too, but the execution will never reach this linen
window.Foo('test');
</script>
<script>
// thoses ones should not fail (as in a real browser)
document.getElementsByTagName(undefined);
document.getElementById(undefined);
document.getElementsByClassName(undefined);
document.querySelector(undefined);
</script>
</body>

0 comments on commit 34823d8

Please sign in to comment.