Hi there,
On Wed, May 20, 2009 at 6:49 PM, Martijn Faassen <[email protected]> wrote:
> The nice thing about this is that I'd not need to modify my templates
> at all to enable this functionality, and no need for a key or repeat
> nr (this could be used as a possible optimization to avoid some DOM
> walking, but would be done so internally).
I just realized again why the unique id does need to contain the path
information; otherwise we cannot properly mimic the behavior of
Lookup. So either a copy of the complete context is pushed into the
lookup dictionary, or a path is stored (along with the original json).
A path would look like this:
[{name: 'foo', index: -1}, {name: 'bar', index 3}]
Plausible hook points look like they exist in _DoSection and
_DoRepeatedSection (in the for loop). The hook would take the context
and the callback as arguments (or alternatively the path and the
callback).
The one missing bit in the code is how to produce the path itself.
ScopedContext could be extended with a 'path' method that
returns it. Unfortunately while the ScopedContext retains index
information on its stack, I don't see how to retrieve section name
information (as the JSON object itself is pushed on the stack). It
should be fairly easy however to extend ScopedContext to also retain
names in the stack.
Regards,
Martijn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JSON
Template" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/json-template?hl=en
-~----------~----~----~----~------~----~------~--~---