Skip to content

Commit e74eee2

Browse files
committedJul 27, 2018
Use template literals and const instead of let
1 parent 690839c commit e74eee2

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed
 

‎slotted-pseudo-element/main.js

+12-9
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@ customElements.define('person-details',
22
class extends HTMLElement {
33
constructor() {
44
super();
5-
let template = document.getElementById('person-template');
6-
let templateContent = template.content;
5+
6+
const template = document.getElementById('person-template');
7+
const templateContent = template.content;
78

89
const shadowRoot = this.attachShadow({mode: 'open'});
910

10-
let style = document.createElement('style');
11-
style.textContent = 'div { padding: 10px; border: 1px solid gray; width: 200px; margin: 10px; }' +
12-
'h2 { margin: 0 0 10px; }' +
13-
'ul { margin: 0; }' +
14-
'p { margin: 10px 0; }' +
15-
'::slotted(*) { color: gray; font-family: sans-serif; } ';
11+
const style = document.createElement('style');
12+
style.textContent = `
13+
div { padding: 10px; border: 1px solid gray; width: 200px; margin: 10px; }
14+
h2 { margin: 0 0 10px; }
15+
ul { margin: 0; }
16+
p { margin: 10px 0; }
17+
::slotted(*) { color: gray; font-family: sans-serif; }
18+
`;
1619

1720
shadowRoot.appendChild(style);
1821
shadowRoot.appendChild(templateContent.cloneNode(true));
1922
}
20-
})
23+
});

0 commit comments

Comments
 (0)
Please sign in to comment.