According to DOM level 4 specs, which is the current version in development, there are some new handy mutation methods available:
The bulletproof way
Assuming we have the following HTML element:
The jQuery way
The new way. FTW.
Having already defined the variable
elem, here’s how to properly remove that node:
Notice the jQuery similarity? This new way is simpler and much more intuitive… for the win.
However, if you’re looking for a larger browser support, there are some polyfills that definitely worth an eye on:
P.S. Beside these new methods, don’t forget about the
Thoughts on becoming a better developer
Dribbble invites giveaway