diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/handlebars/base.js | 5 | ||||
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 5 | ||||
-rw-r--r-- | lib/handlebars/runtime.js | 10 |
3 files changed, 16 insertions, 4 deletions
diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index ad2d9ec..e1cd712 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -7,12 +7,13 @@ var Handlebars = {}; // BEGIN(BROWSER) Handlebars.VERSION = "1.0.0-rc.4"; -Handlebars.COMPILER_REVISION = 3; +Handlebars.COMPILER_REVISION = 4; Handlebars.REVISION_CHANGES = { 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 2: '== 1.0.0-rc.3', - 3: '>= 1.0.0-rc.4' + 3: '== 1.0.0-rc.4', + 4: '>= 1.0.0' }; Handlebars.helpers = {}; diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index c003ce6..8bb1fc5 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -508,8 +508,9 @@ JavaScriptCompiler.prototype = { if (!this.isChild) { var namespace = this.namespace; - var copies = "helpers = helpers || " + namespace + ".helpers;"; - if (this.environment.usePartial) { copies = copies + " partials = partials || " + namespace + ".partials;"; } + + var copies = "helpers = this.merge(helpers, " + namespace + ".helpers);"; + if (this.environment.usePartial) { copies = copies + " partials = this.merge(partials, " + namespace + ".partials);"; } if (this.options.data) { copies = copies + " data = data || {};"; } out.push(copies); } else { diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js index d99019d..2e845c4 100644 --- a/lib/handlebars/runtime.js +++ b/lib/handlebars/runtime.js @@ -18,6 +18,16 @@ Handlebars.VM = { } return programWrapper; }, + merge: function(param, common) { + var ret = param || common; + + if (param && common) { + ret = {}; + Handlebars.Utils.extend(ret, common); + Handlebars.Utils.extend(ret, param); + } + return ret; + }, programWithDepth: Handlebars.VM.programWithDepth, noop: Handlebars.VM.noop, compilerInfo: null |