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.
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.
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...
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...
Simplemente por qué.
Simplemente por qué.
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?
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?
#jquery #webdev #programming #beginners
Origin | Interest | Match
#jquery #webdev #programming #beginners
Origin | Interest | Match
since you are already "in" shadowDOM you can query:
𝘥𝘰𝘤𝘶𝘮𝘦𝘯𝘵
.𝘲𝘶𝘦𝘳𝘺𝘚𝘦𝘭𝘦𝘤𝘵𝘰𝘳("𝘮𝘺𝘦𝘭𝘦𝘮𝘦𝘯𝘵")
.𝘴𝘩𝘢𝘥𝘰𝘸𝘙𝘰𝘰𝘵
.𝘲𝘶𝘦𝘳𝘺𝘚𝘦𝘭𝘦𝘤𝘵𝘰𝘳(`[𝘱𝘢𝘳𝘵="𝘵𝘩𝘪𝘯𝘨"]`)
since you are already "in" shadowDOM you can query:
𝘥𝘰𝘤𝘶𝘮𝘦𝘯𝘵
.𝘲𝘶𝘦𝘳𝘺𝘚𝘦𝘭𝘦𝘤𝘵𝘰𝘳("𝘮𝘺𝘦𝘭𝘦𝘮𝘦𝘯𝘵")
.𝘴𝘩𝘢𝘥𝘰𝘸𝘙𝘰𝘰𝘵
.𝘲𝘶𝘦𝘳𝘺𝘚𝘦𝘭𝘦𝘤𝘵𝘰𝘳(`[𝘱𝘢𝘳𝘵="𝘵𝘩𝘪𝘯𝘨"]`)
Live playground: codepen.io/Jon-DeWitt/p...
Live playground: codepen.io/Jon-DeWitt/p...
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.
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.
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`
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`
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…
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…
document.getElementById("myElement")?.parentElement?.innerHTML = "Hello!";
But what about writing values that might be null or undefined?
document.getElementById("myElement")?.parentElement?.innerHTML = "Hello!";
But what about writing values that might be null or undefined?
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
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
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
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
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.
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.