Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:heading() CSS pseudo-class: Level ranges #3500

Closed
js-choi opened this issue Feb 23, 2018 · 7 comments
Closed

:heading() CSS pseudo-class: Level ranges #3500

js-choi opened this issue Feb 23, 2018 · 7 comments
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: selectors

Comments

@js-choi
Copy link

js-choi commented Feb 23, 2018

As per #3499 (comment), I’d like to propose an enhancement for #3499 such that its :heading(n) CSS pseudo-class accepts range expressions :heading(> n), :heading(< n), :heading(>= n), :heading(<= n), and perhaps simple conjunctions such as :heading(> m, < n). See also #83 and w3c/csswg-drafts#1008.

@js-choi js-choi changed the title :heading CSS pseudo-class: Level ranges Feb 23, 2018
@annevk annevk added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest labels Feb 23, 2018
@Crissov
Copy link

Crissov commented Oct 11, 2019

Wouldnʼt the established An±B microsyntax make more sense to use?

  • :heading(n < 3) = :heading(-n+3)
  • :heading(n > 3) = :heading(n-3)
  • n ∈ {1, 2, 3, 4, 5, 6} for HTML
@annevk
Copy link
Member

annevk commented Oct 11, 2019

That's quite neat and would address @emilio's concern (if used properly). Perhaps not the most intuitive syntax, but copy-and-paste works.

@tabatkins
Copy link
Contributor

An+B is great for selecting the Nth element, or every Nth element. It can be used to select every element before/after a certain N, but it's not very intuitive. I'd much rather use comparison operators like MQs allow.

(I don't think the 2n use-case is needed in headings, so the loss of functionality doesn't seem significant.)

@AmeliaBR
Copy link

As I commented in the related CSS issue discussion, there is open discussion (w3c/csswg-drafts#4140) about adding an intuitive range syntax to the CSS nth-child selectors. If both that and this proposal are adopted, then it would make sense to harmonize the syntax. There might not be much use case for :heading(odd) selector, but it would be simpler for authors and implementers if the bits inside the :heading(numeric selector) and :nth-child(numeric selector) are parsed the same.

@tabatkins
Copy link
Contributor

Yeah, if An+B grows range restrictions, might as well do the full syntax over here too. Better that than special-casing things.

@annevk
Copy link
Member

annevk commented Oct 15, 2019

How likely is that to happen? If that's likely I'd be happy to start with An+B and update once we get there.

@annevk
Copy link
Member

annevk commented Dec 12, 2022

Closing this given that #7829 happened.

If w3c/csswg-drafts#1008 turns into something we can revisit.

@annevk annevk closed this as completed Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: selectors
5 participants