From ac931b8c787704b969247ae0ca4d634be8a727c4 2018-08-16 16:11:41 From: Grant Nestor Date: 2018-08-16 16:11:41 Subject: [PATCH] Drop jquery dependency in IPython.display.Javascript --- diff --git a/IPython/core/display.py b/IPython/core/display.py index 41d9378..521cae8 100644 --- a/IPython/core/display.py +++ b/IPython/core/display.py @@ -852,18 +852,24 @@ class JSON(DisplayObject): def _repr_json_(self): return self._data_and_metadata() -_css_t = """$("head").append($("").attr({ - rel: "stylesheet", - type: "text/css", - href: "%s" -})); +_css_t = """var link = document.createElement("link"); + link.ref = "stylesheet"; + link.type = "text/css"; + link.href = "%s"; + document.head.appendChild(link); """ -_lib_t1 = """$.getScript("%s", function () { -""" -_lib_t2 = """}); +_lib_t1 = """var script = document.createElement("script"); + script.type = "text/javascript"; + script.src = "%s"; + script.onload = script.onreadystatechange = function() { + if (!this.readyState || this.readyState == 'complete') { """ +_lib_t2 = """} + }; + document.head.appendChild(script);""" + class GeoJSON(JSON): """GeoJSON expects JSON-able dict