Skip to content

Commit df7b5d2

Browse files
committed
Add the top level readme and the first 001_web_components_hello_world experiment
0 parents  commit df7b5d2

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Web Lab
2+
3+
A scratch workspace for conducting experiments with HTML, CSS and JavaScript that are loaded by a web browser.
4+
5+
## Exercises
6+
7+
New expermiments are added as a subfolder to the `exercises` folder.
8+
9+
Each experiment folder are prefixed with a three digit, zero padded number to perserve the order in which they were added.
10+
11+
This format was inspired by the [ziglings](https://codeberg.org/ziglings/exercises) project, which in turn was inspired by the [rustlings](https://github.com/rust-lang/rustlings) project.
12+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>Web Components - Hello World</title>
5+
</head>
6+
<body>
7+
<article>
8+
<h1>Web Components</h1>
9+
<p>Below is a simple hello world web component &#128515;</p>
10+
11+
<hello-world></hello-world>
12+
13+
<script type="text/javascript">
14+
class HelloWorld extends HTMLParagraphElement {
15+
constructor() {
16+
super();
17+
const shadow = this.attachShadow({ mode: "closed" });
18+
const text = document.createElement("span");
19+
text.textContent = 'Hello, world!';
20+
shadow.appendChild(text);
21+
}
22+
}
23+
customElements.define("hello-world", HelloWorld, { extends: "p" });
24+
</script>
25+
26+
</article>
27+
</body>
28+
</html>

exercises/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Web Components - Hello World
2+
3+
A simple web component that writes `Hello, world!` on load.
4+
The example referenced was [here](https://jonathanmh.com/p/web-components-101-hello-world/).
5+
6+
## How To Use It
7+
8+
Open index.htm in a browser.

0 commit comments

Comments
 (0)