In IE8, removing an element from the DOM makes it
have a parentNode which is a document fragment
that itself has no parentNode.
This is different than on other browsers that leave
the element with no parentNode.
On IE8, attributes are serialized into innerHTML. Ignore
the $meteor_ui_removal_callbacks attribute that's used
to keep track of callbacks to fire when an element is removed.
we have hard-coded "#each" into errors thrown
from observe-sequence. maybe that's not the right
way to do it but for now it works. if we want to support
other packages using observe-sequence we could
give it a constructor with a string to add to error
messages
Helpers returning dynamically chosen templates shouldn't
set the data context inside the return value. Instead,
the data context should be computed in a separate helper.
Then the `{{> dynamicTemplate dataContext}}` pattern can
be used.
The reason is that if `withData` were to be used in
the return value from helpers, then there's no way to
do fine-grained reactive updates -- we'd have to
re-render the full template each time the dynamic
template is re-computed (even if the data context
hasn't changed at all, say).
according to today's proposal (i.e. it's as if {{> content}} were invoked at the invocation site of the template that uses {{> content}}, as far as scopes are concerned).
Messy implementation with not enough comments. But there's a test.
All tests pass (except one which is a todo on shark).
If `{{> foo bar}}` is to desugar into `{{#with bar}}{{> foo}}{{/with}}`, there needs to be an explicit block in the generated code in which `self.lookup("foo")` binds the correct data context (`bar`). So we now generate a UI.With rather than trying to call it from Spacebars.include. This simplifies Spacebars.include, which is nice.
Define `lookupTemplate` because `self.lookup(.., {template: true})` pretty-prints bigly.
* Use isolateValue around `foo` in `{{> foo}}` as well as `{{#foo}}` (i.e. whether or not there's a content block)
* Make UI.With always embox its argument; this is achieved by moving embox/isolateValue from Spacebars into UI. As a side effected, all reactive closures now use isolateValue, so we avoid re-rendering in a few more cases.
* Avoid calling data argument of `{{#with someHelper}}` twice ever instead of once ever (when helper isn't invalidated)
We now look for a helper named 'foo' (which can return
a dynamically chosen template object) before looking
for a global template named 'foo'. This is consistent
with the principle that adding a helper should generally
override other things with the same name (ie data properties)
This change was motivated by frontpage, which had both
a template and a helper named 'body'.