From a7bd321648595e748efdfd539565e20e3c4ad943 Mon Sep 17 00:00:00 2001 From: MinRK Date: Sat, 25 Jan 2014 17:24:14 -0800 Subject: [PATCH 1/2] don't show tooltip if object is not found closes #4875 --- IPython/html/static/notebook/js/tooltip.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/IPython/html/static/notebook/js/tooltip.js b/IPython/html/static/notebook/js/tooltip.js index 659dcf51c..d0e08097f 100644 --- a/IPython/html/static/notebook/js/tooltip.js +++ b/IPython/html/static/notebook/js/tooltip.js @@ -303,6 +303,10 @@ var IPython = (function (IPython) { // move the bubble if it is not hidden // otherwise fade it var content = reply.content; + if (!content.found) { + // object not found, nothing to show + return; + } this.name = content.name; // do some math to have the tooltip arrow on more or less on left or right From e6f84111cd2ebba78278aeb491bc71d3e122f851 Mon Sep 17 00:00:00 2001 From: MinRK Date: Sat, 25 Jan 2014 17:32:50 -0800 Subject: [PATCH 2/2] treat all falsy values the same in tooltip undefined, null, and empty string are all treated the same. --- IPython/html/static/notebook/js/tooltip.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/IPython/html/static/notebook/js/tooltip.js b/IPython/html/static/notebook/js/tooltip.js index d0e08097f..39bc34b9b 100644 --- a/IPython/html/static/notebook/js/tooltip.js +++ b/IPython/html/static/notebook/js/tooltip.js @@ -341,22 +341,22 @@ var IPython = (function (IPython) { // build docstring var defstring = content.call_def; - if (defstring == null) { + if (!defstring) { defstring = content.init_definition; } - if (defstring == null) { + if (!defstring) { defstring = content.definition; } var docstring = content.call_docstring; - if (docstring == null) { + if (!docstring) { docstring = content.init_docstring; } - if (docstring == null) { + if (!docstring) { docstring = content.docstring; } - if (docstring == null) { + if (!docstring) { // For reals this time, no docstring if (this._hide_if_no_docstring) { return;