Skip to content

Commit 33ddabf

Browse files
committed
Fix typo and code styling
1 parent e0ea1b3 commit 33ddabf

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

JavaScript/3-abstraction.html

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@
22
<html>
33
<head>
44
<script type="application/javascript">
5+
// Case 3: Visual component
56

6-
// Case 3: Visul component
7+
class PageCaption extends HTMLElement {
8+
constructor() {
9+
super();
10+
this.attachShadow({ mode: "open" });
11+
this.clicked = false;
12+
}
713

8-
class PageCaption extends HTMLElement {
9-
constructor() {
10-
super();
11-
this.attachShadow({ mode: 'open' });
12-
this.clicked = false;
13-
}
14-
15-
connectedCallback() {
16-
const html = `<h1>Marcus</h1><button type="button">Ave Marcus!</button>`;
17-
this.shadowRoot.innerHTML = html;
18-
this.shadowRoot.querySelector('button').addEventListener('click', () => {
19-
if (!this.clicked) {
20-
this.clicked = true;
21-
const html = `<h1>Ave Marcus Aurelius!</h1>`;
22-
this.shadowRoot.innerHTML = html;
14+
connectedCallback() {
15+
const html = `<h1>Marcus</h1><button type="button">Ave Marcus!</button>`;
16+
this.shadowRoot.innerHTML = html;
17+
this.shadowRoot
18+
.querySelector("button")
19+
.addEventListener("click", () => {
20+
if (!this.clicked) {
21+
this.clicked = true;
22+
const html = `<h1>Ave Marcus Aurelius!</h1>`;
23+
this.shadowRoot.innerHTML = html;
24+
}
25+
});
26+
}
2327
}
24-
});
25-
}
26-
}
27-
28-
window.customElements.define('page-caption', PageCaption);
2928

29+
window.customElements.define("page-caption", PageCaption);
3030
</script>
3131
</head>
3232
<body>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy