2 ms·
It's certainly not bad practice from a semantic/structural perspective. Contextual selectors become absolutely essential the moment your DOM becomes at all modu
by _bxg1 7y ago
It's certainly not bad practice from a semantic/structural perspective. Contextual selectors become absolutely essential the moment your DOM becomes at all modular.
That said, there are things like BEM (http://getbem.com/naming/ http://getbem.com/naming/) which have popped up to try and maintain that general pattern while trimming down the performance cost. I'm just not sure what that cost actually looks like, impact-wise.
- jolmg 7y agoI don't mean that structure in selectors should never be expressed, but I do think that selector complexity should be avoided. Nesting seems to encourage selectors of arbitrary depth, while having them always start with no context seems to discourage making them too deep. In any case, I found this Editor's Draft[1]. I don't know what the current plans are for it, though. [1] https://tabatkins.github.io/specs/css-nesting/ https://tabatkins.github.io/specs/css-nesting/