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

Add Pseudo selectors #1869

Merged
merged 7 commits into from
Sep 30, 2024
Merged

Add Pseudo selectors #1869

merged 7 commits into from
Sep 30, 2024

Conversation

jamesnw
Copy link
Collaborator

@jamesnw jamesnw commented Sep 30, 2024

Per #1764 (comment), I used select as the verb.

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Sep 30, 2024
Copy link
Collaborator

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one's really close. I have suggestions exclusively on descriptions and comments. Please resolve each as you see fit and merge, or @ me if you have questions. Thank you!

@@ -0,0 +1,13 @@
name: ::before and ::after
description: The `::before` and `::after` CSS pseudo-elements select the first and last children of an element for styling, and are often used with the `content` property to add generated cosmetic content.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written, I think this might be confused with :first-child and :last-child. What do you think of this?

Suggested change
description: The `::before` and `::after` CSS pseudo-elements select the first and last children of an element for styling, and are often used with the `content` property to add generated cosmetic content.
description: The `::before` and `::after` CSS pseudo-elements select inline boxes preceding and following an element. They are often used with the `content` property to generate cosmetic content.

Comment on lines +44 to +64
# baseline: high
# baseline_low_date: ≤2017-03-27
# baseline_high_date: ≤2019-09-27
# support:
# chrome: "26"
# chrome_android: "26"
# edge: "12"
# firefox: "4"
# firefox_android: "4"
# safari: ≤10.1
# safari_ios: ≤10.3
- css.selectors.before.animation_and_transition_support

# baseline: false
# support:
# chrome: "26"
# chrome_android: "26"
# edge: "12"
# firefox: "4"
# firefox_android: "4"
- css.selectors.after.animation_and_transition_support
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This data is pretty bad, but I'm OK with using compute_from to not worry about it for now: mdn/browser-compat-data#18109

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,11 @@
name: :placeholder-shown
description: The `:placeholder-shown` CSS pseudo-element selects `<input>` and `<textarea>` elements when no value is set and placeholder text is shown.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two ideas here:

  • Avoid circularity with "…is shown"
  • Distinguish with similarly-named pseudo?
Suggested change
description: The `:placeholder-shown` CSS pseudo-element selects `<input>` and `<textarea>` elements when no value is set and placeholder text is shown.
description: The `:placeholder-shown` CSS pseudo-element selects `<input>` and `<textarea>` elements when no value is set and the element's `placeholder` attribute is not empty. Not to be confused with `::placeholder`, which selects the placeholder text itself.

@@ -0,0 +1,7 @@
name: ::placeholder
description: The `::placeholder` CSS pseudo-element selects text in `<input>` and `<textarea>` elements when no value is set.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random idea: hint at the use case here?

Suggested change
description: The `::placeholder` CSS pseudo-element selects text in `<input>` and `<textarea>` elements when no value is set.
description: The `::placeholder` CSS pseudo-element selects help text in `<input>` and `<textarea>` elements when no value is set.

description: The `::placeholder` CSS pseudo-element selects text in `<input>` and `<textarea>` elements when no value is set.
spec: https://drafts.csswg.org/css-pseudo-4/#placeholder-pseudo
caniuse: css-placeholder
group: selectors
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered whether this should live with the placeholder attribute. I think they're distinct because they have dramatically different support histories. That said:

Suggested change
group: selectors
group: selectors
# TODO: create some kind of "input placeholders" feature when https://github.com/web-platform-dx/web-features/issues/971 is resolved, combining placeholder selectors and the element attr

@jamesnw jamesnw merged commit dc236c6 into web-platform-dx:main Sep 30, 2024
3 checks passed
@jamesnw jamesnw deleted the pseudo branch September 30, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature definition Creating or defining new features or groups of features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants