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

formSubmit.js ➔ connectedCallback   A

Complexity

Conditions 3

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 14
rs 10
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
        form.requestSubmit();
18
      });
19
    }
20
  }
21
);
22