Skip to content

Navigation Menu

Sign in
Appearance settings
Sign up
Appearance settings

[css-contain] Computed value of shortcut values #5511

Copy link
Copy link

Description

@Loirooriol
Issue body actions

contain has 2 shortcut values, strict and content:

strict: This value turns on all forms of containment except style containment for the element. In other words, it behaves the same as contain: size layout paint;.
content: This value turns on all forms of containment except size containment and style containment for the element. In other words, it behaves the same as contain: layout paint;.

But do they compute to themselves, or do they compute to the expanded list of values?

document.documentElement.style.contain = "content";
getComputedStyle(document.documentElement).contain;
// "content" in both Chromium and Firefox

document.documentElement.style.contain = "layout paint";
getComputedStyle(document.documentElement).contain;
// "content" in Chromium, "layout paint" in Firefox

So Chromium expands the shortcuts in the computed value, and when serializing it uses the shortest serialization principle

If component values can be omitted or replaced with a shorter representation without changing the meaning of the value, omit/replace them.

And in Firefox the specified value computes as-is, so content and layout paint are considered to be different values that just happen to produce the same behavior.

Who is correct? Firefox obeys "Computed value: specified keyword(s)", but "[contain: content] behaves the same as contain: layout paint;" could be understood to mean that they have the same computed value.

Reactions are currently unavailable

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.