handlebars-lang / handlebars-lang/handlebars.js
allowProtoMethods/Properties runtime options do not work for nested objects
- 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
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