So I've been work on a CSS selector engine, and I want to support pseudo-elements (::before, ::after, ::selection, ::first-line, etc). I noticed Slick, Sizzle, and some other popular engines seem to support them, but when looking through their code I found no code for it (now granted, I didn't look that hard). Does anyone know how they do it or some way I could do it?
Here's a simple way to find them in Webkit using jQuery, can fairly easily be converted to standard JS:
$('*').filter(function(){return getComputedStyle(this, ':before').length != 0});
For Gecko based browsers you need something a little different (haven't tested in IE). Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With