3 ms·
Just be aware that the element really has to be empty - any whitespace (including empty child tags etc.) makes the selector ignore it.
by dahauns 10y ago
Just be aware that the element really has to be empty - any whitespace (including empty child tags etc.) makes the selector ignore it.
- err4nt 10y agoYeah, whitespace makes a textNode so an element containing any nodes can't be :empty. Also gotta watch out for those whitespace-only extra nodes when counting the children of an element with JavaScript, it often returns more children than you think at first ;)