{"action":"created","issue":{"url":"https://api.github.com/repos/w3c/csswg-drafts/issues/351","repository_url":"https://api.github.com/repos/w3c/csswg-drafts","labels_url":"https://api.github.com/repos/w3c/csswg-drafts/issues/351/labels{/name}","comments_url":"https://api.github.com/repos/w3c/csswg-drafts/issues/351/comments","events_url":"https://api.github.com/repos/w3c/csswg-drafts/issues/351/events","html_url":"https://github.com/w3c/csswg-drafts/issues/351","id":168038513,"number":351,"title":"[selectors][css-content] :level(an+b) Pseudo Class","user":{"login":"Crissov","id":6200185,"avatar_url":"https://avatars.githubusercontent.com/u/6200185?v=3","gravatar_id":"","url":"https://api.github.com/users/Crissov","html_url":"https://github.com/Crissov","followers_url":"https://api.github.com/users/Crissov/followers","following_url":"https://api.github.com/users/Crissov/following{/other_user}","gists_url":"https://api.github.com/users/Crissov/gists{/gist_id}","starred_url":"https://api.github.com/users/Crissov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Crissov/subscriptions","organizations_url":"https://api.github.com/users/Crissov/orgs","repos_url":"https://api.github.com/users/Crissov/repos","events_url":"https://api.github.com/users/Crissov/events{/privacy}","received_events_url":"https://api.github.com/users/Crissov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-28T08:16:55Z","updated_at":"2016-07-29T01:47:27Z","closed_at":null,"body":"The [generation of bookmark levels](https://drafts.csswg.org/css-content/#bookmark-generation) has been discussed e.g. in #204 and [in November 2015 on www-style](https://lists.w3.org/Archives/Public/www-style/2015Nov/0310.html). @frivoal had shown that it’s nearly impossible to recreate the HTML5 outline algorithm with existing Selectors, so `bookmark-level: auto` would make some sense. That value hasn’t been added to the drafts, though, and I would like to propose a different solution, a new [structural pseudo-class](https://drafts.csswg.org/selectors/#structural-pseudos).\r\n\r\nNesting, stacking or hierarchy levels are of interest for styling in several cases, e.g. headings or sections and lists in document markup languages or layers and sprites in images. So let there be an abstract **level** that depends on the host language and may differ among its element types. Since a pseudo class increases specifity, the following rulesets should sufficiently describe the usually desired behavior for HTML:\r\n\r\n    *,  h1:level(0), h2:level(0), h3:level(0), h4:level(0), h5:level(0), h6:level(0) { bookmark-level: none; }\r\n    h1, h2:level(1), h3:level(1), h4:level(1), h5:level(1), h6:level(1) { bookmark-level: 1; }\r\n    h2, h1:level(2), h3:level(2), h4:level(2), h5:level(2), h6:level(2) { bookmark-level: 2; }\r\n    h3, h1:level(3), h2:level(3), h4:level(3), h5:level(3), h6:level(3) { bookmark-level: 3; }\r\n    h4, h1:level(4), h2:level(4), h3:level(4), h5:level(4), h6:level(4) { bookmark-level: 4; }\r\n    h5, h1:level(5), h2:level(5), h3:level(5), h4:level(5), h6:level(5) { bookmark-level: 5; }\r\n    h6, h1:level(6), h2:level(6), h3:level(6), h4:level(6), h5:level(6) { bookmark-level: 6; }\r\n\r\nThe syntax inside parentheses would probably follow the existing `an+b` syntax, but I‘m not sure we’d need to differentiate `:first-level`, `:last-level` and `:nth-level()`, but it would be consistent.\r\n\r\nLikewise, one could easily ensure the same marker style for items in nested lists, no matter if the structure mixes `ol`, `ul` and `dl`.\r\n\r\n    ul>li:level(2) { list-style-type: disc; }\r\n\r\nPS: Since this is a more generic pseudo class than rather semantic `:heading-level()` (which I think I had proposed unsuccessfully several years ago), the following would **not** be sufficient for HTML:\r\n\r\n    :level(1) { bookmark-level: 1; }\r\n    :level(2) { bookmark-level: 2; }\r\n    :level(3) { bookmark-level: 3; }\r\n    :level(4) { bookmark-level: 4; }\r\n    :level(5) { bookmark-level: 5; }\r\n    :level(6) { bookmark-level: 6; }\r\n"},"comment":{"url":"https://api.github.com/repos/w3c/csswg-drafts/issues/comments/236074179","html_url":"https://github.com/w3c/csswg-drafts/issues/351#issuecomment-236074179","issue_url":"https://api.github.com/repos/w3c/csswg-drafts/issues/351","id":236074179,"user":{"login":"frivoal","id":113268,"avatar_url":"https://avatars.githubusercontent.com/u/113268?v=3","gravatar_id":"","url":"https://api.github.com/users/frivoal","html_url":"https://github.com/frivoal","followers_url":"https://api.github.com/users/frivoal/followers","following_url":"https://api.github.com/users/frivoal/following{/other_user}","gists_url":"https://api.github.com/users/frivoal/gists{/gist_id}","starred_url":"https://api.github.com/users/frivoal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frivoal/subscriptions","organizations_url":"https://api.github.com/users/frivoal/orgs","repos_url":"https://api.github.com/users/frivoal/repos","events_url":"https://api.github.com/users/frivoal/events{/privacy}","received_events_url":"https://api.github.com/users/frivoal/received_events","type":"User","site_admin":false},"created_at":"2016-07-29T01:47:27Z","updated_at":"2016-07-29T01:47:27Z","body":"@tabatkins that same outline algorithm which nobody implements, that is scheduled to be removed from the W3C HTML spec, and has a couple of subtle phrasing differences between the WHATWG and W3C version? :) Jokes aside, it just defines the structure, but not which level is 0 or 1, and it doesn't define what the levels of nested lists are. So I'd like to see an explicit mapping between that and the proposed syntax here.\r\n\r\nMost likely I expect this to make sense and to agree, but I'd rather agree with the actual proposal than which what I guess it might mean."}}
{"actor":{"display_login":"frivoal"}}