Skip to content

Implement support for ::placeholder pseudo-element #19808

Closed

Activity

  1. highfive commented on Jan 18, 2018

    @highfive
  2. tigercosmos commented on Jan 18, 2018

    @tigercosmos
    Contributor

    I am wondering why the spec doesn't mention about opacity and color for ::placeholder?

  3. ferjm commented on Jan 18, 2018

    @ferjm
    ContributorAuthor

    The spec says that all properties that apply to ::first-line also apply to ::placeholder. Is the spec for ::first-line the one that mentions opacity and color as applicable properties.

  4. tigercosmos commented on Jan 18, 2018

    @tigercosmos
    Contributor

    I see. I didn't find that. Thanks!

  5. webbeef commented on Aug 28, 2024

    @webbeef
    Contributor

    Can anyone explain what needs to be done here? Element has a set_placeholder_shown_state() method that marks the node as dirty with a NodeDamage::OtherNodeDamage value when required. I guess what's left is to hook that up also to the ::placeholder pseudo element?

    Are there examples of other similar selectors I can look at?

  6. jdm commented on Sep 1, 2024

    @jdm
    Member

    The ::selection pseudo element might be a useful model, since we supported that in the legacy layout at least. https://github.com/servo/stylo/blob/65f8d1316a0966401bcfb9fa7dd5e3659a1605b2/style/servo/selector_parser.rs#L48 looks like an important note for this work, too.

  7. stevennovaryo commented on May 30, 2025

    @stevennovaryo
    Member

    I believe this would be manageable with the implementation of shadow tree for text <input> element. Which would initially be supported by #37065.

    I picture it would be handled in dom_traversal similar to how ::before and ::after pseudo element. The following gave more context about the styles.

    fn style(&self, context: &SharedStyleContext) -> Arc<ComputedValues> {

    One caveat about this issue is that placeholder in the said shadow DOM implementation is not the direct children of the <input> element, so we would need special cases for that.

    https://github.com/servo/stylo/blob/65f8d1316a0966401bcfb9fa7dd5e3659a1605b2/style/servo/selector_parser.rs#L48 looks like an important note for this work, too.

    The note give a very nice context about the status of the parser, we would definitely need to adjust property_restriction by following the spec https://drafts.csswg.org/css-pseudo/#placeholder-pseudo.

  8. added a commit that references this issue on Mar 9, 2026
    ab83e6e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions