QQ: Which of the following CSS declarations signals “the name is an automatically generated value”?
Poll
Voting ended 23 October at 9:35.
QQ: Which of the following CSS declarations signals “the name is an automatically generated value”? Anonymous poll
Poll
name: auto;
26
63.4%
name: self;
1
2.4%
name: from-element;
4
9.8%
name: auto-id;
41 people voted. 15
36.6%
Voting ended 23 October at 9:35. 9 comments
Or maybe you have better suggestions? Requirements: @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 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”. @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 🤔 @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. |
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)