Created
January 20, 2026 19:42
-
-
Save DeadWisdom/e19514a2709a2b37f7406fbc0ed0d224 to your computer and use it in GitHub Desktop.
<current-year></current-year> custom element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** Displays the current year. Usage: `<current-year>this-gets-replaced</current-year>` */ | |
| class CurrentYear extends HTMLElement { | |
| connectedCallback() { | |
| this.textContent = new Date().getFullYear().toString(); | |
| } | |
| } | |
| customElements.define('current-year', CurrentYear); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment