w3c / w3c/csswg-drafts

[css-gcpm][css-content] "string-set" on elements with no boxes: How to determine which page the assignment is on

Open
#8,404 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-gcpm-3
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

The string-set property applies to "all elements, but not pseudo-elements", which includes elements with no boxes (e.g. via display: none).
Regarding such elements both specifications say ( after https://drafts.csswg.org/css-content-3/#valdef-string-first-except ):
"The content values of named strings are assigned at the point when the content box of the element is first created (or would have been created if the element’s display value is none)."

Determining where a box "would have been" is rather complex, as that could be influenced by it's height (near a page break) which in turn could be influenced by it's content.
Adding that the hypothetical box should be considered to have a block-size of 0 would solve this for simple cases.

However in more complex contexts this would still not be easy to determine, e.g. when the order property is involved.
We would propose to go backwards through the DOM from the element until an element is found that has boxes in the content flow.
The page that the last of those boxes is on is the page of the assignment.
If coordinates on the page are also required they should be at the block-end of that box.
However, we would prefer that inside the page the order of assignments is strictly the DOM order.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CSS Content specification section linked in the issue, especially the rule for assigning named strings when an element has no content box. Examine the display:none, page-break, and order cases described there. Done means reaching and documenting an unambiguous rule for the assignment page and ordering of assignments.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.