Skip to content

[css-display] Explicitly note display:contents does not affect inheritance #1473

Closed

Description

@Loirooriol

display: contents has this note

As only the box tree is affected, any semantics based on the document tree, such as selector-matching and event handling, are not affected.

This is kinda obvious: if display: contents can be set to an element via selector-matching, it shouldn't affect selector-matching. And event handling is entirely a DOM thingie.

CSS Cascade says inheritance follows the document tree but that's a blatant lie, e.g. ::first-line intercepts inheritance for some properties, and it is based on the box tree. Therefore, I don't think it's obvious at all that children elements of a display: contents still inherit from it.

So please note style inheritance is not affected by display: contents neither.

Activity

  1. tabatkins commented on Jul 5, 2017

    @tabatkins
    Member

    Inheritance following the document tree is not a "blatant lie" - it's correct for everything that lives in the tree; ::first-line and ::first-letter are bizarro exceptions that are explicitly called out, because they don't live in the tree properly (that is, if they're included, it's not guaranteed to be a tree anymore, just a DAG).

    But we're fine with calling out inheritance in that sentence too.

  2. added a commit that references this issue on Jul 6, 2017
  3. Loirooriol commented on Jul 15, 2017

    @Loirooriol
    ContributorAuthor

    Inheritance from ::first-line is a mess which eventually should be properly defined in CSS Cascade. Anyways, the edit clarifies the behavior of display: contents, so it's fine, thanks.

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