Skip to content

Commit 718d2e4

Browse files
committed
Use const instead of let
1 parent ecce707 commit 718d2e4

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

composed-composed-path/main.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,30 @@ customElements.define('open-shadow',
33
constructor() {
44
super();
55

6-
let pElem = document.createElement('p');
6+
const pElem = document.createElement('p');
77
pElem.textContent = this.getAttribute('text');
88

9-
let shadowRoot = this.attachShadow({mode: 'open'})
10-
.appendChild(pElem);
11-
9+
const shadowRoot = this.attachShadow({mode: 'open'});
10+
shadowRoot.appendChild(pElem);
11+
}
1212
}
13-
});
13+
);
1414

1515
customElements.define('closed-shadow',
1616
class extends HTMLElement {
1717
constructor() {
1818
super();
1919

20-
let pElem = document.createElement('p');
20+
const pElem = document.createElement('p');
2121
pElem.textContent = this.getAttribute('text');
2222

23-
let shadowRoot = this.attachShadow({mode: 'closed'})
24-
.appendChild(pElem);
23+
const shadowRoot = this.attachShadow({mode: 'closed'});
24+
shadowRoot.appendChild(pElem);
25+
}
2526
}
26-
});
27+
);
2728

28-
document.querySelector('html').addEventListener('click',function(e) {
29+
document.querySelector('html').addEventListener('click', e => {
2930
console.log(e.composed);
3031
console.log(e.composedPath());
3132
});

0 commit comments

Comments
 (0)