Skip to content

Commit 9b2ef8b

Browse files
committed
JS: add test for DOM access where expression appears to have no side effects
1 parent a519eab commit 9b2ef8b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

javascript/ql/test/query-tests/Expressions/ExprHasNoEffect/ExprHasNoEffect.expected

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
| dom.js:2:5:2:30 | a.clien ... ientTop | This expression has no effect. |
2+
| dom.js:2:5:2:50 | a.clien ... === !0 | This expression has no effect. |
3+
| dom.js:2:33:2:50 | a.clientTop === !0 | This expression has no effect. |
4+
| dom.js:3:5:3:20 | a && a.clientTop | This expression has no effect. |
5+
| dom.js:4:5:4:28 | a.clien ... ientTop | This expression has no effect. |
6+
| dom.js:5:18:5:43 | a.clien ... ientTop | This expression has no effect. |
7+
| dom.js:6:18:6:63 | b && (b ... entTop) | This expression has no effect. |
8+
| dom.js:6:23:6:63 | (b.clie ... entTop) | This expression has no effect. |
19
| try.js:22:9:22:26 | x.ordinaryProperty | This expression has no effect. |
210
| tst2.js:2:4:2:4 | 0 | This expression has no effect. |
311
| tst.js:3:1:3:2 | 23 | This expression has no effect. |
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function f(){
2+
a.clientTop && a.clientTop, a.clientTop === !0; // $Alert
3+
a && a.clientTop; // $SPURIOUS:Alert
4+
a.clientTop, a.clientTop; // $SPURIOUS:Alert
5+
if(a) return a.clientTop && a.clientTop, a.clientTop === !0 // $SPURIOUS:Alert
6+
if(b) return b && (b.clientTop, b.clientTop && b.clientTop), null // $SPURIOUS:Alert
7+
}

0 commit comments

Comments
 (0)