Passed
Push — master ( 1b1d3e...93cb6f )
by
unknown
02:31
created

formSubmit.js ➔ connectedCallback   A

Complexity

Conditions 3

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 15
rs 9.95
c 0
b 0
f 0
cc 3
1
// @ts-check
2
3
customElements.define(
0 ignored issues
show
Bug introduced by
The variable customElements seems to be never declared. If this is a global, consider adding a /** global: customElements */ comment.

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.

Loading history...
4
  'pc-form-submit',
5
  class extends HTMLElement {
0 ignored issues
show
Bug introduced by
The variable HTMLElement seems to be never initialized.
Loading history...
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');
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
18
        form.requestSubmit();
19
      });
20
    }
21
  }
22
);
23