diff --git a/lib/jsdoc/augment.js b/lib/jsdoc/augment.js
index f37be4ca..beafecfd 100644
--- a/lib/jsdoc/augment.js
+++ b/lib/jsdoc/augment.js
@@ -201,7 +201,12 @@ function getInheritedAdditions(doclets, docs, documented) {
// Indicate what the descendant is overriding. (We only care about the closest
// ancestor. For classes A > B > C, if B#a overrides A#a, and C#a inherits B#a,
// we don't want the doclet for C#a to say that it overrides A#a.)
- addDocletProperty([member], 'overrides', members[k].longname);
+ if (docs.index.longname[member.longname]) {
+ member.overrides = members[k].longname;
+ }
+ else {
+ delete member.overrides;
+ }
// Add the ancestor's docs unless the descendant overrides the ancestor AND
// documents the override.
diff --git a/templates/default/tmpl/details.tmpl b/templates/default/tmpl/details.tmpl
index 8de29737..d1ff696c 100644
--- a/templates/default/tmpl/details.tmpl
+++ b/templates/default/tmpl/details.tmpl
@@ -32,7 +32,7 @@ if (data.defaultvalue && (data.defaultvaluetype === 'object' || data.defaultvalu
-
+
Inherited From:
-
diff --git a/test/fixtures/augmentstag.js b/test/fixtures/augmentstag.js
index b5e44181..934eede0 100644
--- a/test/fixtures/augmentstag.js
+++ b/test/fixtures/augmentstag.js
@@ -22,6 +22,11 @@ Foo.prototype.method1 = function() {};
*/
Foo.prototype.method2 = function() {};
+/**
+ * Third parent method.
+ */
+Foo.prototype.method3 = function() {};
+
/**
* @constructor
* @extends Foo
diff --git a/test/specs/tags/augmentstag.js b/test/specs/tags/augmentstag.js
index 649bb9f9..fb8a696d 100644
--- a/test/specs/tags/augmentstag.js
+++ b/test/specs/tags/augmentstag.js
@@ -101,10 +101,16 @@
expect(bazMethod2.inherits).toBe('Bar#method2');
});
- it('When the grandparent has a method, and the parent overrides it, the child should say it overrides the parent', function() {
+ it('When the grandparent has a method, the parent overrides it, and the child inherits it, the child should not say it overrides anything', function() {
var bazMethod2 = docSet.getByLongname('Baz#method2')[0];
- expect(bazMethod2.overrides).toBe('Bar#method2');
+ expect(bazMethod2.overrides).not.toBeDefined();
+ });
+
+ it('When the grandparent has a method, the parent inherits it, and the child overrides it, the child should say it overrides the parent', function() {
+ var bazMethod3 = docSet.getByLongname('Baz#method3')[0];
+
+ expect(bazMethod3.overrides).toBe('Bar#method3');
});
it('When an object is extended, and it overrides an ancestor property, the child does not include docs for the ancestor property.', function() {