#myelement
Creating custom HTML elements with #VanillaJS

#DevoxxUK @firt.dev
May 8, 2025 at 8:43 AM
💡 TIL about static initialization blocks in JS classes.

I've been writing JavaScript for almost 15y now, and there's always something new to learn. To be fair, I don't use JavaScript classes often, but static initialization blocks are very neat for the dynamic setup of other static properties.
January 12, 2025 at 4:58 PM
TIL recap: Not too long ago, I learned that you can put "nameless static" blocks into ECMAScript classes. What for?

A static initialization block runs when the ECMAScript class is initialized (don't confuse this with using the class to create a new instance).

www.stefanjudis.com/today-i-lear...
May 12, 2025 at 8:31 AM
throw in a `class extends MyElement {}` in there so you can define it multiple times 😅
May 24, 2025 at 4:42 PM
function() { document.getElementbyId('myElement')addEventListener(click, myFunction); }
July 12, 2026 at 10:41 AM
Programando en Java una cosa y no tengo palabras para definir lo horrible que me parece poder hacer myList.forEach(myElement -> ...)

Simplemente por qué.
February 4, 2025 at 12:03 PM
Web Component folks:

What’s the current thinking / guidance on how one can and should create a new instance of a WC in JS?

Specifically curious about creating elements via `new MyElement()` — is that considered a no-no?
February 20, 2025 at 8:06 PM
50 Most Useful Jquery Snippets latest trending 1. Check if Element Exists if ( $ ( ' #myElement ' ). length ) { console . log ( ' Element exists! ' ); } 2. Iterate Over Each Element...

#jquery #webdev #programming #beginners

Origin | Interest | Match
50 Most Useful Jquery Snippets latest trending
1. Check if Element Exists if ($('#myElement').length) { console.log('Element...
dev.to
October 2, 2025 at 1:10 AM
I was extremely surprised to discover that hidden is actually implemented as basically [hidden]{display:none} in the user stylesheet, meaning that if you do myelement{display:grid} <myelement hidden>, it isn't hidden. So I already tend to assume that <element hidden> won't work :(
February 19, 2025 at 9:55 PM
Note it is not a Web Components show stopper,
since you are already "in" shadowDOM you can query:

𝘥𝘰𝘤𝘶𝘮𝘦𝘯𝘵
.𝘲𝘶𝘦𝘳𝘺𝘚𝘦𝘭𝘦𝘤𝘵𝘰𝘳("𝘮𝘺𝘦𝘭𝘦𝘮𝘦𝘯𝘵")
.𝘴𝘩𝘢𝘥𝘰𝘸𝘙𝘰𝘰𝘵
.𝘲𝘶𝘦𝘳𝘺𝘚𝘦𝘭𝘦𝘤𝘵𝘰𝘳(`[𝘱𝘢𝘳𝘵="𝘵𝘩𝘪𝘯𝘨"]`)
August 11, 2026 at 7:23 AM
Are we still talking about web components? Cause I was inspired to reduce the boilerplate with a functional syntax + signals!

Live playground: codepen.io/Jon-DeWitt/p...
October 8, 2024 at 11:31 PM
Sure, that's what I'm proposing.

Straw example: A `myElement.__devtoolsData__` property which gets visualized in DevTools above all the other random properties for that node.

Any framework (WC or not) could put developer-defined data there and highlight the parts which matter to them.
January 11, 2025 at 1:09 AM
Bonus question:

What about passing parameters into that class creation — i.e. `new MyElement(p1, p2, p3)`?

*Assume there’s logic that will check for the existence of the params and fallback to search for attr/prop values in the case where the WC is created via `document.createElement`
February 20, 2025 at 8:06 PM
If you are using #typescript, both !. (non nullish assertion operator) and ?. (optional chaining operator) may seem similar (probably just me). But they server difference purposes. You use !. to tell the compiler that you are certain that a value is not null or undefined. [image_1] The ?. (1/3)
December 24, 2024 at 10:37 AM
Vanilla JavaScript Equivalent jQuery Tasks Replaced for Performance

Let’s be honest: jQuery has been a lifesaver. For years, it smoothed over the rough edges of cross-browser inconsistencies, particularly with older versions of Internet Explorer. But today, developers have plenty of vanilla…
Vanilla JavaScript Equivalent jQuery Tasks Replaced for Performance
Let’s be honest: jQuery has been a lifesaver. For years, it smoothed over the rough edges of cross-browser inconsistencies, particularly with older versions of Internet Explorer. But today, developers have plenty of vanilla javascript equivalents to jQuery for common tasks like selecting elements, handling events, manipulating classes, and updating the DOM. Writing $('#myElement').hide() once felt like magic compared to the verbose native alternatives, but modern browsers now provide powerful APIs that can handle many of these tasks without relying on a library.
imraan.in
September 13, 2026 at 11:27 AM
🔥#JavaScript tip: Optional chaining is awesome for reading values that _might_ be null or undefined without throwing a bunch of errors.

document.getElementById("myElement")?.parentElement?.innerHTML = "Hello!";

But what about writing values that might be null or undefined?
June 14, 2021 at 6:02 PM
For that last bit with showPopover({source: myelement}) it should work?
September 29, 2025 at 3:11 PM
📰 Elemental's Ember's Emotional Moment: Wade's Words Spark Tears

Wade's gentle tone ignites Ember's vulnerability. Her eyes well up as she confronts her true feelings about being replaced by him in My Element.

🔗 https://andaily.us/YEsq6

#AnimeNews #Twitter #MyElement
March 10, 2026 at 11:14 AM
📰 My Element: A Tale of Fire and Water

Join Akihito as he discovers his elemental power in 'My Element', a tale of fire and water that will leave you breathless.

🔗 https://andaily.us/4Hfry

#AnimeNews #Twitter #MyElement
March 4, 2026 at 1:06 PM
Does anyone know why web components using the `is=<tag-name>` breaks when you try to use a constructor at super()? It seems like the browser is trying to construct a new `MyElement` instance, but since the tag name is different than the original element it freaks out?
November 29, 2024 at 9:47 PM
November 24, 2024 at 8:44 AM
This just got even easier, after adding custom callbacks!

codepen.io/Jon-DeWitt/p...
October 12, 2024 at 6:49 PM
…new ways of building WCs enter the fray.

These new methods are very much influencing the types of WCs I’m seeing in the wild — some of which make solid usage of JS DOM APIs.

With that said, the use of `new MyElement` is definitely something I see very very very rarely.

So again agree/disagree.
February 26, 2025 at 4:19 AM
Can’t wait to finish working so I can get in my element. Baking is definitely one of my comfort spaces #baking #comfort #myelement #dessertsky
December 24, 2024 at 9:02 PM