Skip to content

Commit

Permalink
Improve example by avoiding console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
jgarber623 committed Jan 2, 2025
1 parent 13b48b3 commit 49eb231
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
line-height: 1.5;
padding: 3rem;
}

small {
color: #c00;
display: inline-block;
font-size: 0.875rem;
font-weight: bold;
padding-inline-end: 0.5rem;
}
</style>
</head>
<body>
Expand All @@ -34,13 +42,13 @@ <h1>CashCash: Example</h1>

const main = $("main");
const h1 = $("h1", main[0]);
const p = $("p");
const paragraphs = $("p");

console.log("Main content:", main);
console.log("Primary heading:", h1);
console.log("Paragraphs:", p);
h1[0].insertAdjacentHTML("afterend", `<small>This text is rendered using a reference to the adjacent <code>h1</code> heading element and a context referencing the <code>main</code> element.</small>`);

p.forEach(node => console.log(node.id));
paragraphs.forEach(paragraph => {
paragraph.insertAdjacentHTML("afterbegin", `<small>This text is rendered using a reference to the paragraph element: <code>p#${paragraph.id}</code>.</small>`)
});
</script>

</body>
Expand Down

0 comments on commit 49eb231

Please sign in to comment.