Skip to content

Commit 625466d

Browse files
committed
[css-anchor-1] Anchor names are tree-scoped (but implicit ones dont' necessarily have to be). #7916
1 parent dd7edaa commit 625466d

File tree

1 file changed

+30
-21
lines changed

1 file changed

+30
-21
lines changed

css-anchor-1/Overview.bs

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ The ''anchor()'' function has three arguments:
8585
* the <<dashed-ident>> specifies the [=anchor name=] of the [=anchor element=]
8686
it will be drawing positioning information from.
8787
See [=target anchor element=] for details.
88+
This name is a [=tree-scoped reference=].
8889

8990
If omitted, the function uses an element's [=implicit anchor element=] instead.
9091

@@ -298,6 +299,7 @@ Values are defined as follows:
298299
:: If the element generates a [=principal box=],
299300
the element is an <dfn dfn for local-lt="anchor">anchor element</dfn>,
300301
with an <dfn dfn for>anchor name</dfn> equal to the <<dashed-ident>>.
302+
The [=anchor name=] is a [=tree-scoped name=].
301303

302304
Otherwise, the property has no effect.
303305
</dl>
@@ -311,23 +313,24 @@ might not be capable of anchoring the positioned element.
311313
<div algorithm>
312314
To determine the <dfn>target [=anchor element=]</dfn>
313315
given a querying element |query el|
314-
and an optional anchor name |name|,
315-
find the first element |el| in tree order
316-
which satisfies the following conditions:
317-
318-
* If |name| is not provided,
319-
but |query el| has an [=implicit anchor element=],
320-
|el| is that element.
321-
* If |name| is provided,
322-
|el| is an [=anchor element=] with an [=anchor name=] of |name|.
323-
* Either |el| is a descendant of |query el|'s [=containing block=],
324-
or |query el|'s [=containing block=] is the [=initial containing block=]
325-
* If |el| has the same [=containing block=] as |query el|,
326-
|el| is not [=absolutely positioned=]
327-
* If |el| has a different [=containing block=] from |query el|,
328-
the last [=containing block=] in |el|'s [=containing block chain=]
329-
before reaching |query el|'s [=containing block=]
330-
is not [=absolutely positioned=]
316+
and an optional anchor name |name|:
317+
318+
1. If |name| is not provided:
319+
1. If |query el| has an [=implicit anchor element=],
320+
return that element.
321+
2. Otherwise, return nothing.
322+
2. Otherwise, return the first element |el| in tree order
323+
that satisfies the following conditions:
324+
* |el| and |query el| have the same [=tree/root=].
325+
* |el| is an [=anchor element=] with an [=anchor name=] of |name|.
326+
* Either |el| is a descendant of |query el|'s [=containing block=],
327+
or |query el|'s [=containing block=] is the [=initial containing block=]
328+
* If |el| has the same [=containing block=] as |query el|,
329+
|el| is not [=absolutely positioned=]
330+
* If |el| has a different [=containing block=] from |query el|,
331+
the last [=containing block=] in |el|'s [=containing block chain=]
332+
before reaching |query el|'s [=containing block=]
333+
is not [=absolutely positioned=]
331334

332335
Note: There might not be any such element.
333336

@@ -341,6 +344,12 @@ might not be capable of anchoring the positioned element.
341344
into just what's relevant for this purpose,
342345
ensuring there is no possibly circularity
343346
in anchor positioning.
347+
348+
Note: Anchor names are scoped to the tree the anchor element is in;
349+
if the querying element is in a different [=shadow tree=],
350+
they won't find each other.
351+
[=Implicit anchor elements=] aren't necessarily limited in the same way,
352+
but that might vary depending on the feature assigning the implicit anchor element.
344353
</div>
345354

346355
An element can also have an <dfn export>implicit anchor element</dfn>,
@@ -356,13 +365,13 @@ potentially different [=implicit anchor elements=] on the same element,
356365
this specification will define a resolution order.
357366

358367
<!--
359-
███████ ██ ██ ████████ ████████ ████ ████████ ██████
368+
███████ ██ ██ ████████ ████████ ████ ████████ ██████
360369
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
361-
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
362-
██ ██ ██ ██ ██████ ████████ ██ ██████ ██████
370+
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
371+
██ ██ ██ ██ ██████ ████████ ██ ██████ ██████
363372
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
364373
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
365-
█████ ██ ███████ ████████ ██ ██ ████ ████████ ██████
374+
█████ ██ ███████ ████████ ██ ██ ████ ████████ ██████
366375
-->
367376

368377
Anchor Queries {#queries}

0 commit comments

Comments
 (0)