同步操作将从 OpenHarmony-SIG/jmustache 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
mustache.js v2 introduces a bug fix that breaks compatibility with older versions: fixing null and undefined lookup.
When mustache.js tries to render a variable {{name}}
, it executes a lookup
function to figure out which value it should render. This function looks up the value for the key name
in the current context, and if there is no such key in the current context it looks up the parent contexts recursively.
Value lookup should stop whenever the key exists in the context. However, due to a bug, this was not happening when the value was null
or undefined
even though the key existed in the context.
Here's a simple example of the same template rendered with both mustache.js v1 and v2:
Template:
{{#friends}}
{{name}}'s twitter is: {{twitter}}
{{/friends}}
View:
{
"name": "David",
"twitter": "@dasilvacontin",
"friends": [
{
"name": "Phillip",
"twitter": "@phillipjohnsen"
},
{
"name": "Jan",
"twitter": null
}
]
}
Rendered using mustache.js v1:
Phillip's twitter is: @phillipjohnsen
Jan's twitter is: @dasilvacontin
Rendered using mustache.js v2:
Phillip's twitter is: @phillipjohnsen
Jan's twitter is:
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。