summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/runtime.js
Commit message (Collapse)AuthorAgeFilesLines
* Walk up data frames for nested @partial-blockLon Ingram2016-08-161-1/+6
| | | | | | | | | | | | | | The root cause of #1218 is that `invokePartial` creates a stack of data frames for nested partial blocks, but `resolvePartial` always uses the value at top of the stack without "popping" it. The result is an infinite recursive loop, as references to `@partial-block` in the partial at the top of the stack resolve to itself. So, walk up the stack of data frames when evaluating. This is accomplished by 1) setting the `partial-block` property to `noop` after use and 2) using `_parent['partial-block']` if `partial-block` is `noop` Fix #1218
* Relax depth check for context pushkpdecker2015-12-121-2/+2
| | | | Fixes #1135
* Remove semi-documented _setup and _child APIskpdecker2015-12-121-13/+3
| | | These were a bad idea to begin with and without the trackIds implementation they don’t make much sense.
* Remove stringParams and trackIds modemachty2015-12-101-6/+0
| | | | Closes #1145
* Create data frame for @partial-blockkpdecker2015-09-231-0/+1
| | | Fixes #1099
* Fix use of decorators within partialskpdecker2015-09-041-1/+1
| | | | | If a decorator is used within a partial but not in the calling template, the hash is not passed in. For now error on the side of always including as just assigning values has minimal overhead. Fixes #1089
* Implement decorator helper methodkpdecker2015-08-221-12/+13
|
* Implement inline partialskpdecker2015-08-221-0/+4
| | | | | | Allows for partials to be defined within the current template to allow for localized code reuse as well as for conditional behavior within nested partials. Fixes #1018
* Implement block decoratorskpdecker2015-08-221-2/+21
| | | | These allow for a given block to be wrapped in helper methods or metadata and allow for more control over the current container and method before the code is run.
* Implement decorator environment and registrationkpdecker2015-08-221-0/+4
|
* Implement partial blockskpdecker2015-08-221-1/+14
| | | | | | This allows for failover for missing partials as well as limited templating ability through the `{{> @partial-block }}` partial special case. Partial fix for #1018
* Pass container rather than exec as contextkpdecker2015-08-181-2/+2
| | | There is no real need for us to do `.call(container` other than for backwards compatibility with legacy versions. Using the 4.x release as a chance to optimize this behavior.
* Fix partial handling with different contextkpdecker2015-08-031-1/+1
|
* Always return string responseskpdecker2015-08-031-1/+1
| | | | | Certain optimizations for simple templates could result in objects returned by helpers returned rather than their string representation, resulting in some odd edge cases. This ensures that strings are always returned from the API for consistency. Fixes #1054.
* Avoid depth creation when context remains the samekpdecker2015-08-031-2/+11
| | | | | | | Creating a new depth value seems to confuse users as they don’t expect things like `if` to require multiple `..` to break out of. With the change, we avoid pushing a context to the depth list if it’s already on the top of the stack, effectively removing cases where `.` and `..` are the same object and multiple `..` references are required. This is a breaking change and all templates that utilize `..` will have to check their usage and confirm that this does not break desired behavior. Helper authors now need to take care to return the same context value whenever it is conceptually the same and to avoid behaviors that may execute children under the current context in some situations and under different contexts under other situations. Fixes #1028
* Fix track id handling in partialskpdecker2015-08-031-0/+6
| | | Fixes #914
* Remove out of date TODOkpdecker2015-08-031-2/+0
|
* Update for let and optional parameterskpdecker2015-04-201-19/+16
|
* Add full support for es6kpdecker2015-04-161-30/+30
| | | | | | | | Converts the tool chain to use babel, eslint, and webpack vs. the previous proprietary solutions. Additionally begins enforcing additional linting concerns as well as updates the code to reflect these rules. Fixes #855 Fixes #993
* Add support for dynamic partial nameskpdecker2015-01-181-3/+12
| | | | | | | | | Uses the subexpression syntax to allow for dynamic partial lookups. Ex: ``` {{> (helper) }} ``` Fixes #933
* Implement strict and assumeObject modeskpdecker2014-12-271-0/+6
| | | | | | | | Causes templates to throw when lookup fields are not defined within the context. Strict mode will throw when any field is omitted. assumeObjects mode maintains the existing behavior of outputting an empty response when fields are not defined but allows for performance/size optimizations by not doing safety checks for intermediate objects in the lookup chain. Strict mode effectively disables the helperMissing and inverse handling for blockHelperMissing as templates will throw rather than call those features for missing data fields. Fixes #651 Fixes #805
* Implement block parameterskpdecker2014-12-261-9/+19
| | | Fixes #907
* Treat partial exec in a manner closer to helperskpdecker2014-11-271-14/+13
| | | This helps unify the code handling and will also be needed to support string/id tracking on partials.
* Lookup partials when undefinedkpdecker2014-11-251-0/+3
|
* Propagate options for client compiled partialskpdecker2014-11-081-1/+1
| | | Fixes #901
* Prune unused codekpdecker2014-08-251-3/+1
|
* Add template isTop flagkpdecker2014-08-251-0/+1
|
* Allow passing depths to _childkpdecker2014-08-251-4/+4
|
* Additional test coverage cleanupkpdecker2014-08-231-4/+3
| | | Also fixes the template._child implementation which broke with the depthed work.
* Provide better error on unexpected templatekpdecker2014-08-151-0/+4
| | | Fixes #806
* Increase test coverage a touchkpdecker2014-08-141-0/+1
|
* Implement partial recursive lookupkpdecker2014-08-141-6/+6
|
* Inherit compat flag for partialskpdecker2014-08-141-2/+2
|
* Implement recursive field lookup in compat modekpdecker2014-08-131-0/+8
| | | | | | Provides the mustache behavior of recursive lookup without the use of depthed paths. Note that this does incur a fairly dramatic performance penalty for depthed queries.
* Avoid depth construction overhead for non-depthedkpdecker2014-08-131-1/+1
|
* Use depths array rather than passing array argskpdecker2014-08-131-24/+16
| | | Approximately doubles the throughput performance of depthed templates and clears the way for doing recursive path lookups in pathed mode.
* Render indent for standalone partialskpdecker2014-08-121-4/+17
|
* Move lambda resolution to runtimekpdecker2014-07-061-0/+4
| | | This has a very positive impact on precompiled output size, particularly for known-helpers cases, and little or no impact on the throughput numbers.
* Refactor template init logickpdecker2014-04-131-18/+22
|
* Add child accessor APIkpdecker2014-02-091-1/+6
|
* Add support for depthed resolution of data fieldskpdecker2014-02-091-0/+6
|
* Convert template spec to object literalkpdecker2014-02-061-25/+37
| | | This allows for metadata to be associated with the template and a simplification of the template init logic.
* Optimize initData for root defined casekpdecker2014-01-181-2/+2
|
* Implement partial hash evaluationkpdecker2014-01-171-2/+6
|
* Improve usefulness of extend util, properly use namespace property, update ↵Blake Embrey2014-01-161-3/+2
| | | | setup options to use a hash helper.
* Expose the initial context via @rootkpdecker2014-01-151-1/+8
|
* Include line info in compiler thrown exceptionskpdecker2014-01-011-3/+3
| | | Fixes #636
* Expose compilerInfo and checkRevision as APIskpdecker2013-12-231-2/+2
| | | Fixes #656
* Use env.VM to lookup runtime methodskpdecker2013-12-231-16/+11
| | | | | Allows for overrides by 3rd parties Fixes #679
* Handle empty responses from partialskpdecker2013-12-231-2/+2
| | | Fixes #675
* Run jshint on outputkpdecker2013-12-011-1/+0
| | | Allows us to execute jshint in non-forced mode.
* Access utils methods via moduleskpdecker2013-10-141-4/+5
| | | | | | Allows for monkey patching (under ES5 systems). This somewhat mirrors the proposed behavior in https://github.com/square/es6-module-transpiler/issues/37 but applies the behavior via manual code changes rather than compiler support.
* Cleanup unused var warningskpdecker2013-10-091-1/+1
|
* Use template env and compile methodskpdecker2013-10-091-8/+8
|
* fixing jshint errorsAlex Navasardyan2013-10-041-10/+11
|
* Break exception class out into a standalone modulekpdecker2013-10-011-1/+2
|
* Fix merge errorskpdecker2013-09-021-8/+8
|
* Merge branch 'master' into es6-moduleskpdecker2013-09-021-19/+38
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Gruntfile.js Rakefile dist/handlebars.js dist/handlebars.runtime.js lib/handlebars.js lib/handlebars/base.js lib/handlebars/runtime.js lib/handlebars/utils.js package.json
| * Optimize partial helper/partial merge handlingkpdecker2013-08-241-19/+37
| |
* | Make the Handlebars environment into an objectYehuda Katz2013-07-261-9/+7
| | | | | | | | | | | | | | | | The idea is that the environment wraps up the mutable stuff in Handlebars (like the helpers) and that you could theoretically create a new one at any time and pass it in to Handlebars.template. Every test makes a new environment and uses it in template compilation.
* | Further progress towards modularization.Yehuda Katz2013-07-241-14/+31
| | | | | | | | | | At this point, I have only 2 fails in the Node build, but I'm doing a bunch of manual stuff locally and still have a bunch of hacks.
* | Initial work on ES6 modulesYehuda Katz2013-07-011-103/+99
|/
* Merge global and passed helpers and partialskpdecker2013-05-311-0/+10
|
* Add program metadatakpdecker2013-02-171-11/+15
| | | | | | Include program id and depth on the generated wrapper objects. This allows helpers who are passed these objects to differentiate between helpers for cases where they may want to cache the generated DOM structure.
* mergeTommy Messbauer2013-02-111-2/+22
|\
| * Better error messages for precompiler runtime mismatchPeter Wagenet2013-02-091-3/+18
| |
| * Decouple compiler version checks from release versionsPeter Wagenet2013-02-081-2/+2
| |
| * Improved precompile template version checkPeter Wagenet2013-01-301-2/+7
| | | | | | | | | | This check reduces duplicated code as well as also failing if the template was precompiled on a version before the check was added.
* | Merged upstream master and ran unit testsTommy Messbauer2012-11-261-2/+2
|\ \ | |/
| * Ensure plain text partials supplied to registerPartials are compiled using ↵Kiall Mac Innes2012-09-131-1/+1
| | | | | | | | data: true if necessary.
* | Factory update with tabs to spaces.. sorry :(Tommy Messbauer2012-11-261-58/+58
| |
* | Commiting initial factory codeTommy Messbauer2012-08-291-57/+61
|/
* Added a missing `var` statement.Nick Fisher2012-01-171-1/+1
|
* Rename "vm" to "runtime" for clarityYehuda Katz2011-12-271-0/+68
|
* Remove unnecessary original runtime implementationtomhuda2011-05-031-267/+0
|
* Use prototype toString method to avoid native types being returned.Alex Stupka2011-01-171-2/+2
| | | | * For example, mozilla returns [xpconnect native prototype wrapper] vs [object Function]
* Restructure things more simplywycats2010-12-291-13/+1
|
* Clean up after-effects of Jison fixwycats2010-12-281-2/+1
|
* Add optimized compiled version of handlebars, which should be significantly ↵wycats2010-12-181-1/+1
| | | | | | | | | | | faster. Use Handlebars.VM.compile instead of Handlebars.compile to use the optimized version. Major TODOS: * clean up a bunch of code duplication in the compiler * reorganize the compiler * add support for debug symbols which would make it possible to provide information about what part of the source caused a runtime error.
* Everything is working now on the new VM except for partials and inverse sectionswycats2010-12-151-1/+1
|
* Small restructuring. Have I mentioned how much I hate having to write ↵wycats2010-12-121-21/+20
| | | | modules that work in both CommonJS and the browser?
* Allow helperMissing to apply to simple mustaches (paves the way to support ↵wycats2010-12-111-5/+16
| | | | things like link_to in a Rails context)
* Make it possible to register helpers and partials and then skip passing in ↵wycats2010-12-111-17/+17
| | | | the helpers or partials later
* lintingwycats2010-12-041-12/+15
|
* Fix up the compilation processwycats2010-12-041-29/+37
|
* Finish compatibility with the old handlebars:wycats2010-12-031-27/+62
| | | | | | * foo"bar" is an invalid param * {{foo}}bar{{/baz}} is invalid * fix a number of issues with inverse sections * add partials
* A few more lingering bugs:wycats2010-12-031-1/+36
| | | | | | | * add helperMissing.not to the specs * add Handlebars.Utils.isEmpty * add runtime handling for inverse sections * fix __get__ to pass an IdNode to evaluate * handle case in wrapProgram where context is undefined
* Fix a number of outstanding issues:wycats2010-12-021-3/+8
| | | | | | | | | | | | * {{}} escape their contents, {{{}}} and {{& }} do not * Add support in the parser, tokenizer and AST for partials with context (support is still not there in the runtime) * Fix some inconsistencies with the old behavior involving the correct printing of null and undefined * Add Handlebars.Exception * Fixed an issue involving ./foo and this/foo * Fleshed out helperMissing in the specs (this will be moved out into handlebars proper once registerHelper and registerPartial are added)
* Got Qunit tests running through RSpec and fixed a bunch of bugs... 33 fails ↵wycats2010-11-281-1/+5
| | | | from the original suite to go
* Add initial support for blocks wycats2010-11-261-3/+63
|
* Start working on the runtimewycats2010-11-251-0/+120