Files
handlebars.js/spec
Nils Knappmeier c8f4b570c1 Fix context-stack when calling block-helpers on null values
Fixes #1319

Original behaviour:
- When a block-helper was called on a null-context, an empty object was used
  as context instead. (#1093)
- The runtime verifies that whether the current context equals the
  last context and adds the current context to the stack, if it is not.
  This is done, so that inside a block-helper, the ".." path can be used
  to go back to the parent element.
- If the helper is called on a "null" element, the context was added, even
  though it shouldn't be, because the "null != {}"

Fix:
- The commit replaces "null" by the identifiable "container.nullContext"
  instead of "{}". "nullContext" is a sealed empty object.
- An additional check in the runtime verifies that the context is
  only added to the stack, if it is not the nullContext.

Backwards compatibility within 4.0.x-versions:
- This commit changes the compiler and compiled templates would not work
  with runtime-versions 4.0.0 - 4.0.6, because of the "nullContext"
  property. That's way, the compiled code reads
  "(container.nullContext || {})" so that the behavior will degrade
  gracefully with older runtime versions: Everything else will work
  fine, but GH-1319 will still be broken, if you use a newer compiler
  with a pre 4.0.7 runtime.
2017-03-25 15:00:58 +01:00
..
2014-11-08 14:35:23 -06:00
2015-11-19 22:53:31 -06:00
2015-09-01 01:43:00 -05:00
2015-08-03 23:43:00 -05:00
2015-08-18 23:57:27 -07:00
2015-09-01 17:56:32 -05:00
2015-08-22 10:59:34 -07:00
2015-09-01 17:56:32 -05:00
2015-04-16 16:43:01 -05:00
2015-09-23 21:59:58 -05:00
2015-09-01 17:56:32 -05:00
2015-04-16 16:43:01 -05:00
2015-08-22 11:13:08 -07:00
2015-04-16 16:43:01 -05:00
2015-09-01 17:56:32 -05:00
2015-04-16 16:43:01 -05:00
2015-04-16 16:43:01 -05:00
2015-08-03 12:16:02 -05:00
2015-09-01 01:44:35 -05:00
2015-08-22 10:59:34 -07:00
2015-04-16 16:43:01 -05:00