Skip to content

[css-content] Clarify valid and default values of string-set #13244

@Crissov

Description

@Crissov

In the 2003 WD of CSS Content, it was anticipated that the string-set property would take as its value a list of pairs of custom ident and source:

The 'string-set' property accepts values similar to the 'content' property, including the extraction of the current value of counters.

META[author] { string-set: author attr(author); }
HEAD > TITLE { string-set: title contents; }

All subsequently released drafts of that module, including the current ED, limited the capability of this property in prose. It is supposed to effectively always store the equivalent of content() or content(text):

The string-set property copies the text content of an element into a named string, …

However, its syntax requires at least one <string> after the initial custom identifier in order to select what should be stored in the named string:

Value: none | [ <custom-ident> <string>+ ]#

Accordingly, some of the following examples contain functions that return a <string>:

h2 { string-set: heading content() }
h1 { string-set: header content(before) ':' content(text); }
section { string-set: header attr(title) }

However, the very first example contains the keyword contents in place of a <string>:

H1 { string-set: chapter contents; }

This keyword is specified in section 2.3 of the same module as part of the <content-list> type, which is strongly tailored to the content property.

<content-list> = [ <string> | <image> | <attr()> | contents | <quote> | <leader()> | <target> | <string()> | <content()> | <counter> ]+

In conclusion, please clarify the default and valid values of the string-set property, which might look like one of these:

  1. none | <custom-ident> – suggested by current prose
  2. none | <custom-ident># – also consistent with current prose
  3. none | [ <custom-ident> <string>* ]# – compromise between current syntax and prose
  4. none | [ <custom-ident> <string>+ ]# – current syntax
  5. none | [ <custom-ident> <content-list>+ ]# – suggested by examples
  6. none | [ <custom-ident> [ <string> | <counter> | <attr()> | <content()>]* ]# – covers all examples except the first which would be changed to use content() instead, also includes all types available in the fallback "/ alt" value of the content property

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions