Passed
Pull Request — master (#437)
by
unknown
02:25
created

src/assets/customElements/formSubmit.js   A

Complexity

Total Complexity 3
Complexity/F 1.5

Size

Lines of Code 19
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

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

1 Function

Rating   Name   Duplication   Size   Complexity  
A formSubmit.js ➔ connectedCallback 0 14 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
        form.requestSubmit();
18
      });
19
    }
20
  }
21
);
22