JS: Modernize jQuery attribute defs

This commit is contained in:
Asger F
2019-09-04 18:24:17 +01:00
parent a224186fab
commit c1e9eec267
6 changed files with 57 additions and 32 deletions

View File

@@ -0,0 +1,4 @@
| tracking.js:15:5:15:26 | e.attr( ... 'foo') | class | tracking.js:15:21:15:25 | 'foo' |
| tracking.js:17:7:17:18 | color: 'red' | color | tracking.js:17:14:17:18 | 'red' |
| tracking.js:18:7:18:18 | size: '12pt' | size | tracking.js:18:13:18:18 | '12pt' |
| tst.js:3:1:3:44 | $("<a/> ... e.com") | href | tst.js:3:24:3:43 | "https://semmle.com" |

View File

@@ -0,0 +1,4 @@
import javascript
from DOM::AttributeDefinition def
select def, def.getName(), def.getValueNode()

View File

@@ -1,7 +1,9 @@
WARNING: Type JQueryMethodCall has been deprecated and may be removed in future (JQueryMethodCall.ql:3,6-22)
| tracking.js:7:5:7:24 | this.elm.html('foo') | html |
| tracking.js:14:5:14:17 | e.html('foo') | html |
| tracking.js:18:7:18:15 | $('#foo') | $ |
| tracking.js:15:5:15:26 | e.attr( ... 'foo') | attr |
| tracking.js:16:5:19:6 | e.attr( ... \\n }) | attr |
| tracking.js:23:7:23:15 | $('#foo') | $ |
| ts_global_types.ts:3:5:3:17 | e.html('foo') | html |
| ts_global_types.ts:7:1:7:9 | $('#foo') | $ |
| ts_import.ts:5:5:5:17 | e.html('foo') | html |

View File

@@ -1,7 +1,7 @@
WARNING: Type JQueryMethodCall has been deprecated and may be removed in future (interpretsArgumentAsHtml.ql:3,6-22)
| tracking.js:7:5:7:24 | this.elm.html('foo') | tracking.js:7:19:7:23 | 'foo' |
| tracking.js:14:5:14:17 | e.html('foo') | tracking.js:14:12:14:16 | 'foo' |
| tracking.js:18:7:18:15 | $('#foo') | tracking.js:18:9:18:14 | '#foo' |
| tracking.js:23:7:23:15 | $('#foo') | tracking.js:23:9:23:14 | '#foo' |
| ts_global_types.ts:3:5:3:17 | e.html('foo') | ts_global_types.ts:3:12:3:16 | 'foo' |
| ts_global_types.ts:7:1:7:9 | $('#foo') | ts_global_types.ts:7:3:7:8 | '#foo' |
| ts_import.ts:5:5:5:17 | e.html('foo') | ts_import.ts:5:12:5:16 | 'foo' |

View File

@@ -12,6 +12,11 @@ class C {
*/
doSomethingWithTypes(e) {
e.html('foo');
e.attr('class', 'foo');
e.attr({
color: 'red',
size: '12pt',
});
}
}