4 ms·
It's a little disappointing if the :has selector never makes it into stylesheets, just JavaScript's querySelector. Then again I'm thankful for what we already h
by combatentropy 10y ago
It's a little disappointing if the :has selector never makes it into stylesheets, just JavaScript's querySelector. Then again I'm thankful for what we already have. For example, even the old :hover selector seems to me like it would have been slow, but it's not. Others like :checked, :disabled, and :target further eliminate some JavaScript. HTML 5 eliminates more, like autofocus, datepickers, and most form checking (I think? I haven't used it much.)
The :has selector would have wiped out all but about 2% of my JavaScript needs. Don't get me wrong. I don't mind JavaScript as much as other people. In fact, I kind of like it. But given the choice between declarative (CSS) and procedural (JavaScript) it's generally shorter to use declarative.