Skip to content

Commit e58268a

Browse files
committed
clarify some of the reference resolution docs
1 parent d238a3c commit e58268a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

docs/edge/References.md.hbs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ By themselves, references are useless - they must *resolve* to a *{{{createLink
77

88
The resolution algorithm looks like this:
99

10-
1. Is the reference a special ref? If so, resolve with the appropriate special keypath.
10+
1. Is the reference a special ref (starting with `@` - see <a href="#special-refs">sepcial references below</a>)? If so, resolve with the appropriate special keypath.
1111
2. If the reference is prefixed (`./`, `../`, `^^/`), resolve it.
1212
3. If the current context has a matching key, then resolve with it.
1313
4. Grab the current virtual node from the template hierarchy.
1414
5. If there are any aliases, index, or key mapping defined that match, resolve with that keypath.
1515
6. If this is a component and there are any matching mappings, resolve with that keypath.
1616
7. If this node has context and there is a matching path, resolve with that keypath.
1717
8. Otherwise, remove the innermost context from the stack. Repeat (3-7).
18-
9. If not disabled, check to see if there's a matching Ractive instance method or property, and if so, resolve with it.
19-
10. If the reference is still unresolved, add it to the 'pending resolution' pile. Each time potentially matching keypaths are updated, resolution will be attempted for the unresolved reference.
18+
9. If {{{createLink 'Options' 'resolveInstanceMembers' 'resolveInstanceMembers'}}} is not disabled, check to see if there's a matching Ractive instance method or property, and if so, resolve with it.
19+
10. If the reference is still unresolved, add it to the 'pending resolution' pile, a list of unresolved keys that is registered with each model that could possibly have a matching key in the future. Each time potentially matching models are updated, resolution will be attempted for their unresolved references.
2020

2121
## Huh?
2222

@@ -197,6 +197,7 @@ Sometimes you have a nested context that puts a parent completely out of reach b
197197
That's a terribly contrived example, as reasonable scenarios tend to be considerably more complex, but it gets the point across. Within the `~/bar` context, there's no way to access the current `foos` iteration. That's where the `^^/` prefix comes in. It mirrors what the `../` prefix does with keypaths, except it operates on the context stack. Like `../` it is also stackable, so if you need to access a much higher context ancestor, you can do so e.g. `^^/^^/^^/^^/ohMy`.
198198

199199
## Special references
200+
<a name="special-refs"></a>
200201

201202
There are a few things that can be useful to reference from the template that don't really exist in your data. For instance, the current iteration index of a repeated section. These special references can be used just like any other data reference, excepting two-way binding. Here's the list of specials and their resolutions:
202203

0 commit comments

Comments
 (0)