Thanks to visit codestin.com
Credit goes to github.com

Skip to content

"Failover content" not working in multiple levels of inline partials #1089

@michaellopez

Description

@michaellopez

This is a follow up on #1018

I came up with this test to illustrate the issue.

it('should support failover content in multiple levels of inline partials', function() {
    var string = '{{#> layout}}{{/layout}}';
    var partials = {
      doctype: 'doctype{{> content}}',
      layout: '{{#> doctype}}{{#*inline "content"}}layout{{#> subcontent}}subcontent{{/subcontent}}{{/inline}}{{/doctype}}'
    };
    shouldCompileToWithPartials(string, [{}, {}, partials], true, 'doctypelayoutsubcontent');
  });

Gives me this:

...
  1) Regressions should support failover content in multiple levels of inline partials:
     TypeError: Cannot read property 'inline' of undefined
      at Function.eval (eval at compile (.../handlebars.js/dist/cjs/handlebars/compiler/javascript-compiler.js:9:6645), <anonymous>:5:18)
      at executeDecorators (dist/handlebars.runtime.js:1206:16)
      at wrapProgram (dist/handlebars.runtime.js:1142:11)
      at Object.program (dist/handlebars.runtime.js:1046:27)
      at Object.eval (eval at createFunctionContext (.../handlebars.js/dist/cjs/handlebars/compiler/javascript-compiler.js:9:13103), <anonymous>:5:102)
      at main (dist/handlebars.runtime.js:1093:33)
      at Object.ret (dist/handlebars.runtime.js:1096:13)
      at Object.ret [as layout] (.../handlebars.js/dist/cjs/handlebars/compiler/compiler.js:9:28227)
      at Object.invokePartialWrapper [as invokePartial] (dist/handlebars.runtime.js:992:47)
      at Object.eval (eval at createFunctionContext (.../handlebars.js/dist/cjs/handlebars/compiler/javascript-compiler.js:9:13103), <anonymous>:5:31)
...

For all three environments: runtime, browser, node.

Unfortunatly I am not familiar with the code base, so I'm having a hard time writing the fix and submitting a PR.

@kpdecker

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions