handlebars-lang / handlebars-lang/handlebars.js

allowProtoMethods/Properties runtime options do not work for nested objects

Open
#1,858 1 comment 0 reactions 0 assignees View on GitHub
needs investigation
Dominant language
JavaScript
Stars
18.7k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

For example, given the following input:

``` javascript
function TestClass() {}
TestClass.prototype.aMethod = function() {
return 'returnValue'
};
TestClass.prototype.nested = new TestClass()
const context = new TestClass()
```

the following,
``` javascript
const template = Handlebars.compile('{{nested.aMethod}}')
template(context, {allowProtoMethodsByDefault: true})
```
should yield `'returnValue'`. Instead, it yields `'undefined'`.

PR with failing test-cases submitted: #1859.

Contributor guide

Open the contributing guide

Research direction

Start with the failing test cases in PR #1859 and trace how allowProtoMethodsByDefault is applied during nested property lookup. Done means compiling {{nested.aMethod}} with the shown TestClass context returns 'returnValue' when the runtime option is enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
handlebars, javascript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.