Email or username:

Password:

Forgot your password?
Top-level
Bramus

QQ2: Which of the following CSS declarations signals “the name is derived from the id attribute, falling back an automatically generated value”?

(Answer 4 is `first-non-empty(attr(id), auto)` but it wouldn’t fit in the box)

Anonymous poll

Poll

name: auto;
2
6.9%
name: self;
3
10.3%
name: from-element;
12
41.4%
name: first-non-empty(…);
14
48.3%
29 people voted.
Voting ended 23 October at 9:36.
7 comments
Bramus

Or maybe you have better suggestions?

Requirements:
1. Name is derived from the id attribute (stretch req: any attribute)
2. Name is auto generated
3. First try 1, falling back to 2

Bramus

RT = Easier to handle View Transitions for all of you, soon!

Stuart Langridge

@bramus "auto" already has meanings in CSS (width:auto, etc) which implies to me on first read that "auto" means "the default" or "what it would be if you hadn't said anything", which is very much not the same as "we will make up a sort of random string". So I don't like "auto" (I appreciate that "we make up a name" IS the "default" here so "auto" is technically correct, but it confuses me). The point about being auto-generated isn't that it's auto, it's that it's generated. name:generated?

Bramus

@sil Note that `auto` is not always “the default” though.

The initial-value for `view-transition-name` – which is what I am targeting here – is `none`, not `auto`.

Stuart Langridge

@bramus sure! I’m not really saying that it always is; as I say, “auto” is probably technically correct here. But I think the vague “meaning” of auto in people’s heads, and certainly in mine, is a sort of “go back to what it would be if you hadn’t said anything”, which doesn’t quite feel the same as “explicitly set a value but it’s the value we would use if you don’t express a preference”.

Jonathan Dallas

@bramus I’m not quite sure I follow what’s being asked here.

The stretch requirement would seem to suggest `attr()` should be used, but because you could be selecting multiple elements it’s a bit awkward. That didn’t stop CSS counters from doing similar stuff though 🤷‍♂️

It might be useful to see all the expected usecases laid out in an article 🤔

Bruno Stasse

@bramus I haven't followed the recent developments of ´attr()´, but couldn't it be used here? ´attr(id, auto)´, the second value being a fallback if the attribute is not found.

Go Up