From d749bc1aa0667bf7183bf86f6bd7e1b9018b31a6 2014-12-04 16:03:30 From: Nicholas Bollweg (Nick) Date: 2014-12-04 16:03:30 Subject: [PATCH] accept node or selection --- diff --git a/IPython/html/static/widgets/js/widget.js b/IPython/html/static/widgets/js/widget.js index e5d51c1..6b966de 100644 --- a/IPython/html/static/widgets/js/widget.js +++ b/IPython/html/static/widgets/js/widget.js @@ -576,16 +576,20 @@ define(["widgets/js/manager", return elements; }, - typeset: function($el, text){ - // after (optionally) updating a selection's text, check if - // MathJax is available and typeset it + typeset: function(element, text){ + // after (optionally) updating a node(list) or jQuery selection's + // text, check if MathJax is available and typeset it + var $el = element.jquery ? element : $(element); + if(arguments.length > 1){ $el.text(text); } if(!window.MathJax){ return; } - return MathJax.Hub.Queue(["Typeset", MathJax.Hub, $el.get(0)]); + return $el.map(function(){ + return MathJax.Hub.Queue(["Typeset", MathJax.Hub, this]); + }); }, });