But if I start typing, let's see, we'll see zero emojis found. Wait, but I promised you a counter here. Well, apparently the way the counter works is that it goes element by element by element, increment by increment by increment, and then adds everything. But in our before element, well, way before each of the elements were found, so we don't have any matches. So what could we do?
We could do after, right? But if I do it with it after, well, it's down here. This is not good because we don't want to scroll all the way to the bottom just to show that. So what can we do? Well, this is another cool trick. What we want to do here is say that the emoji list should be displayed flex. And, well, the next thing that we want to do is let's do order minus one for the after. And this will pull the after element all the way to the beginning of the emoji list.
So what happens now is that I type, and, well, you'll see that because we turned it into flex, then it's obviously all messed up. So let's also flex direction column, and let's refresh. Okay, so now we're seeing that we have 353 emojis found. We have the entire list all sorted correctly. And, well, let's see what's going on. Yeah, we have a working count. Let's add some space here. Cool.
Now, another cool thing that we can do just with CSS, well, or another cool improvement upon CSS that they added recently is CSS nesting. So this is pretty convoluted, I would say, and this is pretty complex. But what if we could just nest everything under the emoji list? So I'm just going to fix it real quick and move everything to be under the emoji list. That's pretty cool. And even the after element, or the after pseudo element, should work as well, just like this. And now if I refresh and start typing, we'll see that everything works as it worked just before. So I think this is pretty cool. And again, let's try to compare it to what it was before in terms of performance. Let's slow it down, and let's try to see how much time it takes. Oh my God, I refreshed it while throttling. Okay, let's try again. And even while throttling, this is pretty instantaneous.
Comments