Total Complexity | 3 |
Complexity/F | 1.5 |
Lines of Code | 20 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | // @ts-check |
||
3 | customElements.define( |
||
|
|||
4 | 'pc-form-submit', |
||
5 | class extends HTMLElement { |
||
6 | connectedCallback() { |
||
7 | const form = this.querySelector('form'); |
||
8 | |||
9 | if (!form) { |
||
10 | console.warn('<form> element not found'); |
||
11 | return; |
||
12 | } |
||
13 | |||
14 | const eventName = this.getAttribute('on') || 'form:request-submit'; |
||
15 | |||
16 | this.addEventListener(eventName, () => { |
||
17 | console.log('submit'); |
||
18 | form.requestSubmit(); |
||
19 | }); |
||
20 | } |
||
21 | } |
||
22 | ); |
||
23 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.