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

src/assets/customElements/formSubmit.js   A

Complexity

Total Complexity 3
Complexity/F 1.5

Size

Lines of Code 20
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 12
mnd 1
bc 1
fnc 2
dl 0
loc 20
rs 10
bpm 0.5
cpm 1.5
noi 3
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A formSubmit.js ➔ connectedCallback 0 15 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