From 0eff2bb6511caa24e8eba10b38cb3fbed317bebf Mon Sep 17 00:00:00 2001 From: MinRK Date: Thu, 13 Feb 2014 09:41:26 -0800 Subject: [PATCH] handle space-only strings, not just zero-length --- IPython/html/static/notebook/js/widgets/widget_bool.js | 4 ++-- IPython/html/static/notebook/js/widgets/widget_container.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/IPython/html/static/notebook/js/widgets/widget_bool.js b/IPython/html/static/notebook/js/widgets/widget_bool.js index 8b966d131..6acbe7693 100644 --- a/IPython/html/static/notebook/js/widgets/widget_bool.js +++ b/IPython/html/static/notebook/js/widgets/widget_bool.js @@ -56,7 +56,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){ this.$checkbox.prop('disabled', disabled); var description = this.model.get('description'); - if (description.length === 0) { + if (description.trim().length === 0) { this.$label.hide(); } else { this.$label.text(description); @@ -102,7 +102,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){ this.$el.prop('disabled', disabled); var description = this.model.get('description'); - if (description.length === 0) { + if (description.trim().length === 0) { this.$el.html(" "); // Preserve button height } else { this.$el.text(description); diff --git a/IPython/html/static/notebook/js/widgets/widget_container.js b/IPython/html/static/notebook/js/widgets/widget_container.js index 76838f90f..e6d51f6a8 100644 --- a/IPython/html/static/notebook/js/widgets/widget_container.js +++ b/IPython/html/static/notebook/js/widgets/widget_container.js @@ -236,14 +236,14 @@ define(["notebook/js/widgets/widget"], function(WidgetManager) { // Called when the model is changed. The model may have been // changed by another view or by a state update from the back-end. var description = this.model.get('description'); - if (description.length === 0) { + if (description.trim().length === 0) { this.$title.html(" "); // Preserve title height } else { this.$title.text(description); } var button_text = this.model.get('button_text'); - if (button_text.length === 0) { + if (button_text.trim().length === 0) { this.$show_button.html(" "); // Preserve button height } else { this.$show_button.text(button_text);