From 7cffe80461a03e69ec4c2832dc4c095b75a60225 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Mon, 18 May 2015 16:46:21 -0700 Subject: [PATCH] Get rid of reverse dependency for security, remove single jquery usage in security in favor of native dom element creation --- notebook/static/base/js/namespace.js | 1 + notebook/static/base/js/security.js | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/notebook/static/base/js/namespace.js b/notebook/static/base/js/namespace.js index 342111fb9..f3e72692e 100644 --- a/notebook/static/base/js/namespace.js +++ b/notebook/static/base/js/namespace.js @@ -4,6 +4,7 @@ var IPython = IPython || {}; define(function(){ var utils = require('base/js/utils'); + IPython.security = require('base/js/security'); IPython.utils = utils; IPython.load_extensions = utils.load_extensions; diff --git a/notebook/static/base/js/security.js b/notebook/static/base/js/security.js index 872d50573..f2bd20317 100644 --- a/notebook/static/base/js/security.js +++ b/notebook/static/base/js/security.js @@ -2,10 +2,8 @@ // Distributed under the terms of the Modified BSD License. define([ - 'base/js/namespace', - 'jquery', 'components/google-caja/html-css-sanitizer-minified', -], function(IPython, $) { +], function(sanitize) { "use strict"; var noop = function (x) { return x; }; @@ -59,7 +57,7 @@ define([ * sanitize just the css in style tags in a block of html * called by sanitize_html, if allow_css is true */ - var h = $("
").append(html); + var h = document.createElement('div').append(html); var style_tags = h.find("style"); if (!style_tags.length) { // no style tags to sanitize @@ -123,7 +121,5 @@ define([ sanitize_html: sanitize_html }; - IPython.security = security; - return security; });