{"action":"created","issue":{"url":"https://api.github.com/repos/less/less.js/issues/1075","repository_url":"https://api.github.com/repos/less/less.js","labels_url":"https://api.github.com/repos/less/less.js/issues/1075/labels{/name}","comments_url":"https://api.github.com/repos/less/less.js/issues/1075/comments","events_url":"https://api.github.com/repos/less/less.js/issues/1075/events","html_url":"https://github.com/less/less.js/issues/1075","id":9262480,"node_id":"MDU6SXNzdWU5MjYyNDgw","number":1075,"title":"Parent Selectors should have targets","user":{"login":"scottrippey","id":430608,"node_id":"MDQ6VXNlcjQzMDYwOA==","avatar_url":"https://avatars3.githubusercontent.com/u/430608?v=4","gravatar_id":"","url":"https://api.github.com/users/scottrippey","html_url":"https://github.com/scottrippey","followers_url":"https://api.github.com/users/scottrippey/followers","following_url":"https://api.github.com/users/scottrippey/following{/other_user}","gists_url":"https://api.github.com/users/scottrippey/gists{/gist_id}","starred_url":"https://api.github.com/users/scottrippey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottrippey/subscriptions","organizations_url":"https://api.github.com/users/scottrippey/orgs","repos_url":"https://api.github.com/users/scottrippey/repos","events_url":"https://api.github.com/users/scottrippey/events{/privacy}","received_events_url":"https://api.github.com/users/scottrippey/received_events","type":"User","site_admin":false},"labels":[{"id":2103423,"node_id":"MDU6TGFiZWwyMTAzNDIz","url":"https://api.github.com/repos/less/less.js/labels/feature%20request","name":"feature request","color":"fe9400","default":false},{"id":9603654,"node_id":"MDU6TGFiZWw5NjAzNjU0","url":"https://api.github.com/repos/less/less.js/labels/medium%20priority","name":"medium priority","color":"0000E0","default":false},{"id":43298739,"node_id":"MDU6TGFiZWw0MzI5ODczOQ==","url":"https://api.github.com/repos/less/less.js/labels/needs%20decision","name":"needs decision","color":"a319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":114,"created_at":"2012-12-13T19:07:08Z","updated_at":"2018-06-16T18:53:31Z","closed_at":null,"author_association":"NONE","body":"When creating a Parent Selector rule, everything before the `&` gets prepended to the outermost scope.  \n\nThe feature could be greatly improved by allowing for \"parent targeting\", where you could apply the parent selector to a specific parent (in the case where you have deeply nested selectors).\n\nThe syntax for this feature is probably the biggest hindrance, so I would love to start a discussion on the possibilities.\n"},"comment":{"url":"https://api.github.com/repos/less/less.js/issues/comments/397832262","html_url":"https://github.com/less/less.js/issues/1075#issuecomment-397832262","issue_url":"https://api.github.com/repos/less/less.js/issues/1075","id":397832262,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzgzMjI2Mg==","user":{"login":"matthew-dean","id":414752,"node_id":"MDQ6VXNlcjQxNDc1Mg==","avatar_url":"https://avatars1.githubusercontent.com/u/414752?v=4","gravatar_id":"","url":"https://api.github.com/users/matthew-dean","html_url":"https://github.com/matthew-dean","followers_url":"https://api.github.com/users/matthew-dean/followers","following_url":"https://api.github.com/users/matthew-dean/following{/other_user}","gists_url":"https://api.github.com/users/matthew-dean/gists{/gist_id}","starred_url":"https://api.github.com/users/matthew-dean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthew-dean/subscriptions","organizations_url":"https://api.github.com/users/matthew-dean/orgs","repos_url":"https://api.github.com/users/matthew-dean/repos","events_url":"https://api.github.com/users/matthew-dean/events{/privacy}","received_events_url":"https://api.github.com/users/matthew-dean/received_events","type":"User","site_admin":false},"created_at":"2018-06-16T18:53:31Z","updated_at":"2018-06-16T18:53:31Z","author_association":"MEMBER","body":"@momomo \r\n> What's wrong with:\r\n\r\nThere's nothing particularly \"wrong\" with it. In fact, for a while now, Less has allowed functions to be called at practically any node. So you could likely do this as a Less `@plugin`. I wonder if that's not the best way to resolve this.\r\n\r\nBut, as far as syntax, IMO it's not a good fit in the Less language, because there are a few oddities / outliers in that construction, such as wrapping selectors in quotes, and calling a function at the root. Which you CAN do and define functions for that purpose. So if you want to solve this as a plugin, you can do it today, without any Less syntax changes whatsoever. It would be called literally with:\r\n\r\n```less\r\n@plugin \"closest\";\r\n.body {\r\n  .main {\r\n    .section {\r\n      .article {\r\n        closest(\".main\", {\r\n          &:hover {\r\n            background-color: red;\r\n          }\r\n          &.someclass {\r\n            background-color: blue;\r\n          }\r\n        });\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nThe only tricky part: whatever selector is returned by `closest()` will still have all the same merging rules applied. I still think that a plugin could manage to give the desired behavior. \r\n\r\n"}}
{"actor":{"display_login":"matthew-dean"}}