@@ -85,6 +85,7 @@ The ''anchor()'' function has three arguments:
85
85
* the <<dashed-ident>> specifies the [=anchor name=] of the [=anchor element=]
86
86
it will be drawing positioning information from.
87
87
See [=target anchor element=] for details.
88
+ This name is a [=tree-scoped reference=] .
88
89
89
90
If omitted, the function uses an element's [=implicit anchor element=] instead.
90
91
@@ -298,6 +299,7 @@ Values are defined as follows:
298
299
:: If the element generates a [=principal box=] ,
299
300
the element is an <dfn dfn for local-lt="anchor">anchor element</dfn> ,
300
301
with an <dfn dfn for>anchor name</dfn> equal to the <<dashed-ident>> .
302
+ The [=anchor name=] is a [=tree-scoped name=] .
301
303
302
304
Otherwise, the property has no effect.
303
305
</dl>
@@ -311,23 +313,24 @@ might not be capable of anchoring the positioned element.
311
313
<div algorithm>
312
314
To determine the <dfn>target [=anchor element=]</dfn>
313
315
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=]
331
334
332
335
Note: There might not be any such element.
333
336
@@ -341,6 +344,12 @@ might not be capable of anchoring the positioned element.
341
344
into just what's relevant for this purpose,
342
345
ensuring there is no possibly circularity
343
346
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.
344
353
</div>
345
354
346
355
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,
356
365
this specification will define a resolution order.
357
366
358
367
<!--
359
- ███████ ██ ██ ████████ ████████ ████ ████████ ██████
368
+ ███████ ██ ██ ████████ ████████ ████ ████████ ██████
360
369
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
361
- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
362
- ██ ██ ██ ██ ██████ ████████ ██ ██████ ██████
370
+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
371
+ ██ ██ ██ ██ ██████ ████████ ██ ██████ ██████
363
372
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
364
373
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
365
- █████ ██ ███████ ████████ ██ ██ ████ ████████ ██████
374
+ █████ ██ ███████ ████████ ██ ██ ████ ████████ ██████
366
375
-->
367
376
368
377
Anchor Queries {#queries}
0 commit comments