From 7b1fdf814c5ce9f7b061696a8d7ede392d8d0f3b Mon Sep 17 00:00:00 2001
From: kpdecker <kpdecker@gmail.com>
Date: Fri, 4 Sep 2015 09:09:17 -0500
Subject: [PATCH 1/3] Fix use of decorators within partials

If a decorator is used within a partial but not in the calling template, the hash is not passed in. For now error on the side of always including as just assigning values has minimal overhead.

Fixes #1089
---
 lib/handlebars/runtime.js | 2 +-
 spec/regressions.js       | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js
index 6b31a7ba4..52d9b9483 100644
--- a/lib/handlebars/runtime.js
+++ b/lib/handlebars/runtime.js
@@ -161,7 +161,7 @@ export function template(templateSpec, env) {
       if (templateSpec.usePartial) {
         container.partials = container.merge(options.partials, env.partials);
       }
-      if (templateSpec.useDecorators) {
+      if (templateSpec.usePartial || templateSpec.useDecorators) {
         container.decorators = container.merge(options.decorators, env.decorators);
       }
     } else {
diff --git a/spec/regressions.js b/spec/regressions.js
index ae0797e9a..cca126e37 100644
--- a/spec/regressions.js
+++ b/spec/regressions.js
@@ -212,4 +212,12 @@ describe('Regressions', function() {
     };
     shouldCompileToWithPartials(string, [{}, {}, partials], true, 'doctypelayoutsubcontent');
   });
+  it('GH-1089: 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');
+  });
 });

From c83354101eb01ae87090b22dfb5d99023d6a0dd0 Mon Sep 17 00:00:00 2001
From: kpdecker <kpdecker@gmail.com>
Date: Fri, 4 Sep 2015 09:12:48 -0500
Subject: [PATCH 2/3] Update release notes

---
 release-notes.md | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/release-notes.md b/release-notes.md
index ef55b63e8..822cb80fa 100644
--- a/release-notes.md
+++ b/release-notes.md
@@ -2,7 +2,12 @@
 
 ## Development
 
-[Commits](https://github.com/wycats/handlebars.js/compare/v4.0.1...master)
+[Commits](https://github.com/wycats/handlebars.js/compare/v4.0.2...master)
+
+## v4.0.2 - September 4th, 2015
+- [#1089](https://github.com/wycats/handlebars.js/issues/1089) - "Failover content" not working in multiple levels of inline partials ([@michaellopez](https://api.github.com/users/michaellopez))
+
+[Commits](https://github.com/wycats/handlebars.js/compare/v4.0.1...v4.0.2)
 
 ## v4.0.1 - September 2nd, 2015
 - Fix failure when using decorators in partials - 05b82a2

From a5a3ab01d3659b996234e3fa5a4a32350a145096 Mon Sep 17 00:00:00 2001
From: kpdecker <kpdecker@gmail.com>
Date: Fri, 4 Sep 2015 09:13:16 -0500
Subject: [PATCH 3/3] v4.0.2

---
 components/bower.json           | 2 +-
 components/handlebars.js.nuspec | 2 +-
 lib/handlebars/base.js          | 2 +-
 package.json                    | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/components/bower.json b/components/bower.json
index cb17eb32d..0f54800af 100644
--- a/components/bower.json
+++ b/components/bower.json
@@ -1,6 +1,6 @@
 {
   "name": "handlebars",
-  "version": "4.0.1",
+  "version": "4.0.2",
   "main": "handlebars.js",
   "license": "MIT",
   "dependencies": {}
diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec
index ee1fce077..ebdb8932c 100644
--- a/components/handlebars.js.nuspec
+++ b/components/handlebars.js.nuspec
@@ -2,7 +2,7 @@
 <package>
 	<metadata>
 		<id>handlebars.js</id>
-		<version>4.0.1</version>
+		<version>4.0.2</version>
 		<authors>handlebars.js Authors</authors>
 		<licenseUrl>https://github.com/wycats/handlebars.js/blob/master/LICENSE</licenseUrl>
 		<projectUrl>https://github.com/wycats/handlebars.js/</projectUrl>
diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js
index 087874a5d..53469eb2d 100644
--- a/lib/handlebars/base.js
+++ b/lib/handlebars/base.js
@@ -4,7 +4,7 @@ import {registerDefaultHelpers} from './helpers';
 import {registerDefaultDecorators} from './decorators';
 import logger from './logger';
 
-export const VERSION = '4.0.1';
+export const VERSION = '4.0.2';
 export const COMPILER_REVISION = 7;
 
 export const REVISION_CHANGES = {
diff --git a/package.json b/package.json
index 8752ea0e7..970d13e4c 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "name": "handlebars",
   "barename": "handlebars",
-  "version": "4.0.1",
+  "version": "4.0.2",
   "description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration",
   "homepage": "http://www.handlebarsjs.com/",
   "keywords": [
