diff --git a/IPython/html/static/widgets/js/widget.js b/IPython/html/static/widgets/js/widget.js index 2e4892e..23fa385 100644 --- a/IPython/html/static/widgets/js/widget.js +++ b/IPython/html/static/widgets/js/widget.js @@ -390,11 +390,15 @@ define(["widgets/js/manager", } }, - typeset: function(text, $el){ - // check if MathJax is available, and if so use it to - // typeset some jQuery selection - $el.text(text); - if(!window.MathJax){ return; } + typeset: function($el, text){ + // after (optionally) updating a selection's text, check if + // MathJax is available and typeset it + if(arguments.length > 1){ + $el.text(text); + } + if(!window.MathJax){ + return; + } return MathJax.Hub.Queue(["Typeset", MathJax.Hub, $el.get(0)]); } }); diff --git a/IPython/html/static/widgets/js/widget_bool.js b/IPython/html/static/widgets/js/widget_bool.js index f9986f0..9b84118 100644 --- a/IPython/html/static/widgets/js/widget_bool.js +++ b/IPython/html/static/widgets/js/widget_bool.js @@ -62,7 +62,7 @@ define([ if (description.trim().length === 0) { this.$label.hide(); } else { - this.typeset(description, this.$label); + this.typeset(this.$label, description); this.$label.show(); } } diff --git a/IPython/html/static/widgets/js/widget_box.js b/IPython/html/static/widgets/js/widget_box.js index 5da898f..e7850ce 100644 --- a/IPython/html/static/widgets/js/widget_box.js +++ b/IPython/html/static/widgets/js/widget_box.js @@ -319,7 +319,7 @@ define([ if (description.trim().length === 0) { this.$title.html(" "); // Preserve title height } else { - this.typeset(description, this.$title); + this.typeset(this.$title, description); } var button_text = this.model.get('button_text'); diff --git a/IPython/html/static/widgets/js/widget_int.js b/IPython/html/static/widgets/js/widget_int.js index 7d53d7a..4b10705 100644 --- a/IPython/html/static/widgets/js/widget_int.js +++ b/IPython/html/static/widgets/js/widget_int.js @@ -155,7 +155,7 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.typeset(description, this.$label); + this.typeset(this.$label, description); this.$label.show(); } @@ -322,7 +322,7 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.typeset(description, this.$label); + this.typeset(this.$label, description); this.$label.show(); } } @@ -441,7 +441,7 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.typeset(description, this.$label); + this.typeset(this.$label, description); this.$label.show(); } return ProgressView.__super__.update.apply(this); diff --git a/IPython/html/static/widgets/js/widget_selection.js b/IPython/html/static/widgets/js/widget_selection.js index 4ad1960..52742ae 100644 --- a/IPython/html/static/widgets/js/widget_selection.js +++ b/IPython/html/static/widgets/js/widget_selection.js @@ -97,7 +97,7 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.typeset(description, this.$label); + this.typeset(this.$label, description); this.$label.show(); } } @@ -230,7 +230,7 @@ define([ this.$label.hide(); } else { this.$label.text(description); - this.typeset(description, this.$label); + this.typeset(this.$label, description); this.$label.show(); } } @@ -345,7 +345,7 @@ define([ this.$label.hide(); } else { this.$label.text(); - this.typeset(description, this.$label); + this.typeset(this.$label, description); this.$label.show(); } } @@ -467,7 +467,7 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.typeset(description, this.$label); + this.typeset(this.$label, description); this.$label.show(); } } diff --git a/IPython/html/static/widgets/js/widget_string.js b/IPython/html/static/widgets/js/widget_string.js index 5b85ee3..eb1d783 100644 --- a/IPython/html/static/widgets/js/widget_string.js +++ b/IPython/html/static/widgets/js/widget_string.js @@ -43,7 +43,7 @@ define([ * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ - this.typeset(this.model.get('value'), this.$el); + this.typeset(this.$el, this.model.get('value')); return LatexView.__super__.update.apply(this); }, }); @@ -114,7 +114,7 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.typeset(description, this.$label); + this.typeset(this.$label, description); this.$label.show(); } } @@ -197,7 +197,7 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.typeset(description, this.$label); + this.typeset(this.$label, description); this.$label.show(); } }