Node isConnected
Every so often I discover a property in JavaScript objects that I didn't know existed, oftentimes using another trick to accomplish the same functionality. One such property I just learned about was isConnected
, a node property that attached to a context (i.e. document
).
Here's how to use Node.prototype.isConnected
:
const el = document.createElement('div');
el.isConnected; // false
document.body.appendChild(el);
el.isConnected; // true
I used to run parentNode
checks on the element to see if it had been injected but that's not always accurate, so I'm glad isConnected
exists!
I remember the early days of JavaScript where you needed a simple function for just about everything because the browser vendors implemented features differently, and not just edge features, basic features, like addEventListener
and attachEvent
. Times have changed but there are still a few functions each developer should...
In the past we've tinkered with link nudging with MooTools and link nudging with jQuery. In an effort to familiarize myself with other JavaScript frameworks, we're going to try to duplicate that effect with another awesome framework: Dojo.
The JavaScript: Attempt...
There's nothing like a subtle, slick website widget that effectively uses CSS and JavaScript to enhance the user experience. Of course widgets like that take many hours to perfect, but it doesn't take long for that effort to be rewarded with above-average user retention and...