From d903dcbb720d54e65980deec04a892eb595e315e Mon Sep 17 00:00:00 2001 From: Ayo Date: Thu, 21 Dec 2023 19:39:48 +0100 Subject: [PATCH] update content --- _posts/2023-12-21-reactive-custom-elements-with-html-dataset.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/2023-12-21-reactive-custom-elements-with-html-dataset.md b/_posts/2023-12-21-reactive-custom-elements-with-html-dataset.md index dcc6562..eec0aa2 100644 --- a/_posts/2023-12-21-reactive-custom-elements-with-html-dataset.md +++ b/_posts/2023-12-21-reactive-custom-elements-with-html-dataset.md @@ -44,7 +44,7 @@ class Counter extends HTMLElement { customElements.define("my-counter", Counter); ``` -In this example we use the standard `dataset` that collects all attributes prefixed with `data-`. `HTMLElement.dataset` exposes them for reading and writing and, because they have attribute counterparts, they will trigger the `attributeChangedCallback()` when modified and if they are observed attributes we explicitly indicated via `static observedAttributes`. +In this example we use the standard `dataset` that collects all attributes prefixed with `data-`. The `dataset` property exposes them for reading and writing and, because they have attribute counterparts, they will trigger the `attributeChangedCallback()` when modified. Hence, every time the user clicks the element, the program modifies the observed `data-count` attribute and the update to the UI via `textContent` is triggered.