{"action":"created","issue":{"url":"https://api.github.com/repos/rstacruz/rscss/issues/7","labels_url":"https://api.github.com/repos/rstacruz/rscss/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/rstacruz/rscss/issues/7/comments","events_url":"https://api.github.com/repos/rstacruz/rscss/issues/7/events","html_url":"https://github.com/rstacruz/rscss/issues/7","id":57275455,"number":7,"title":"Overuse of child selectors (>) make refactoring a nightmare","user":{"login":"localpcguy","id":593240,"avatar_url":"https://avatars.githubusercontent.com/u/593240?v=3","gravatar_id":"","url":"https://api.github.com/users/localpcguy","html_url":"https://github.com/localpcguy","followers_url":"https://api.github.com/users/localpcguy/followers","following_url":"https://api.github.com/users/localpcguy/following{/other_user}","gists_url":"https://api.github.com/users/localpcguy/gists{/gist_id}","starred_url":"https://api.github.com/users/localpcguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/localpcguy/subscriptions","organizations_url":"https://api.github.com/users/localpcguy/orgs","repos_url":"https://api.github.com/users/localpcguy/repos","events_url":"https://api.github.com/users/localpcguy/events{/privacy}","received_events_url":"https://api.github.com/users/localpcguy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-02-11T04:27:49Z","updated_at":"2015-05-04T21:12:43Z","closed_at":null,"body":"I really want to love this, it is really close to many of the things I like. But there is way too much use of direct child selectors.  The CSS should not be so heavily tied to the DOM structure, plus they increase specificity, which is best to keep as low as possible.  Yes, you have to give up the potential of having nested class names, but that seems like an anti-pattern.  \r\n\r\nFrom the [MDN section on efficient CSS](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Writing_efficient_CSS):  \r\n**Tag category rules should never contain a child selector**\r\nAvoid using the child selector with tag category rules.\r\n\r\nand \r\n\r\n**Question all usages of the child selector**\r\nExercise caution when using the child selector. Avoid it if you can.\r\n\r\nWhile I know that specific article was written a while ago, there is still the argument that the child selectors too tightly ties to the DOM structure.  Sometimes you may not have 100% control of the markup (i.e. when writing templates for a CMS) or you may want to refactor the HTML.  Child selectors make that extremely difficult.  I don't believe the benefits of using the child selector outweigh the maintainability issues using them presents."},"comment":{"url":"https://api.github.com/repos/rstacruz/rscss/issues/comments/98851105","html_url":"https://github.com/rstacruz/rscss/issues/7#issuecomment-98851105","issue_url":"https://api.github.com/repos/rstacruz/rscss/issues/7","id":98851105,"user":{"login":"localpcguy","id":593240,"avatar_url":"https://avatars.githubusercontent.com/u/593240?v=3","gravatar_id":"","url":"https://api.github.com/users/localpcguy","html_url":"https://github.com/localpcguy","followers_url":"https://api.github.com/users/localpcguy/followers","following_url":"https://api.github.com/users/localpcguy/following{/other_user}","gists_url":"https://api.github.com/users/localpcguy/gists{/gist_id}","starred_url":"https://api.github.com/users/localpcguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/localpcguy/subscriptions","organizations_url":"https://api.github.com/users/localpcguy/orgs","repos_url":"https://api.github.com/users/localpcguy/repos","events_url":"https://api.github.com/users/localpcguy/events{/privacy}","received_events_url":"https://api.github.com/users/localpcguy/received_events","type":"User","site_admin":false},"created_at":"2015-05-04T21:12:43Z","updated_at":"2015-05-04T21:12:43Z","body":"@mcgwiz My entire point was kinda proven by your post - the specificity is what makes refactoring a nightmare, not the mechanics of refactoring. The mechanics are easy. Trying to mimic the \"structure\" of the front end HTML is a (admittedly, IMO) very bad idea. I also disagree that this keeps the CSS \"loosely-coupled\" - it actually very tightly couples the CSS and the HTML. \r\n\r\nThe ONLY advantage is the readability because it mimics the HTML, and as I already stated, I don't believe the disadvantages of that outweigh the small advantage gained in readability.  (Personally, I don't even find it more readable, but I can accept that argument as valid.)"}}