diff --git a/IPython/html/static/widgets/js/widget.js b/IPython/html/static/widgets/js/widget.js index 7850d3f6f..2e4892e2b 100644 --- a/IPython/html/static/widgets/js/widget.js +++ b/IPython/html/static/widgets/js/widget.js @@ -390,15 +390,12 @@ define(["widgets/js/manager", } }, - typeset: function(element){ + typeset: function(text, $el){ // check if MathJax is available, and if so use it to - // typeset some DOM + // typeset some jQuery selection + $el.text(text); if(!window.MathJax){ return; } - return MathJax.Hub.Queue([ - "Typeset", - MathJax.Hub, - element - ]); + 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 1a8e94af4..f9986f086 100644 --- a/IPython/html/static/widgets/js/widget_bool.js +++ b/IPython/html/static/widgets/js/widget_bool.js @@ -62,8 +62,7 @@ define([ if (description.trim().length === 0) { this.$label.hide(); } else { - this.$label.text(description); - this.typeset(this.$label.get(0)); + this.typeset(description, this.$label); this.$label.show(); } } diff --git a/IPython/html/static/widgets/js/widget_box.js b/IPython/html/static/widgets/js/widget_box.js index 7fc31f7a4..5da898f59 100644 --- a/IPython/html/static/widgets/js/widget_box.js +++ b/IPython/html/static/widgets/js/widget_box.js @@ -319,8 +319,7 @@ define([ if (description.trim().length === 0) { this.$title.html(" "); // Preserve title height } else { - this.$title.text(description); - this.typeset(this.$title.get(0)); + this.typeset(description, this.$title); } 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 0ef415f3c..7d53d7a8f 100644 --- a/IPython/html/static/widgets/js/widget_int.js +++ b/IPython/html/static/widgets/js/widget_int.js @@ -155,8 +155,7 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.$label.text(description); - this.typeset(this.$label.get(0)); + this.typeset(description, this.$label); this.$label.show(); } @@ -323,8 +322,7 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.$label.text(description); - this.typeset(this.$label.get(0)); + this.typeset(description, this.$label); this.$label.show(); } } @@ -443,8 +441,7 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.$label.text(description); - this.typeset(this.$label.get(0)); + this.typeset(description, this.$label); 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 d364772f4..4ad1960e3 100644 --- a/IPython/html/static/widgets/js/widget_selection.js +++ b/IPython/html/static/widgets/js/widget_selection.js @@ -97,8 +97,7 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.$label.text(description); - this.typeset(this.$label.get(0)); + this.typeset(description, this.$label); this.$label.show(); } } @@ -231,7 +230,7 @@ define([ this.$label.hide(); } else { this.$label.text(description); - this.typeset(this.$label.get(0)); + this.typeset(description, this.$label); this.$label.show(); } } @@ -345,8 +344,8 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.$label.text(description); - this.typeset(this.$label.get(0)); + this.$label.text(); + this.typeset(description, this.$label); this.$label.show(); } } @@ -468,8 +467,7 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.$label.text(description); - this.typeset(this.$label.get(0)); + this.typeset(description, this.$label); this.$label.show(); } } diff --git a/IPython/html/static/widgets/js/widget_string.js b/IPython/html/static/widgets/js/widget_string.js index c26120abc..5b85ee354 100644 --- a/IPython/html/static/widgets/js/widget_string.js +++ b/IPython/html/static/widgets/js/widget_string.js @@ -43,8 +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.$el.text(this.model.get('value')); - this.typeset(this.$el.get(0)); + this.typeset(this.model.get('value'), this.$el); return LatexView.__super__.update.apply(this); }, }); @@ -115,8 +114,7 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.$label.text(description); - this.typeset(this.$label.get(0)); + this.typeset(description, this.$label); this.$label.show(); } } @@ -199,8 +197,7 @@ define([ if (description.length === 0) { this.$label.hide(); } else { - this.$label.text(description); - this.typeset(this.$label.get(0)); + this.typeset(description, this.$label); this.$label.show(); } }