How to use the @jupyterlab/apputils.defaultSanitizer.sanitize function in @jupyterlab/apputils

To help you get started, we’ve selected a few @jupyterlab/apputils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it('should allow audio tags with some attributes', () => {
      const audio =
        '<audio src="my/audio.ogg autoplay loop ' + 'controls muted"></audio>';
      expect(defaultSanitizer.sanitize(audio)).to.equal(audio);
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it('should strip link tags', () =&gt; {
      const link = '';
      expect(defaultSanitizer.sanitize(link)).to.equal('');
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it('should allow the class attribute for code tags', () =&gt; {
      const code = '<code class="foo">bar</code>';
      expect(defaultSanitizer.sanitize(code)).to.equal(code);
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it('should allow img tags and some attributes', () =&gt; {
      const img =
        '<img width="42" height="42" alt="Smiley face" src="smiley.gif">';
      expect(defaultSanitizer.sanitize(img)).to.equal(img);
    });
github jupyterlab / jupyterlab / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it("should strip 'orphans' properties from inline CSS", () =&gt; {
      const div = '<div style="orphans: 3;"></div>';
      expect(defaultSanitizer.sanitize(div)).to.equal('<div></div>');
    });
  });
github jupyterlab / jupyterlab-data-explorer / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it('should allow audio tags with some attributes', () =&gt; {
      const audio =
        '<audio src="my/audio.ogg autoplay loop ' + 'controls muted"></audio>';
      expect(defaultSanitizer.sanitize(audio)).to.equal(audio);
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it('should allow h1 tags', () =&gt; {
      const h1 = '<h1>foo</h1>';
      expect(defaultSanitizer.sanitize(h1)).to.equal(h1);
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it("should strip 'content' properties from inline CSS", () =&gt; {
      const div = '<div style="color: green; content: attr(title)"></div>';
      expect(defaultSanitizer.sanitize(div)).to.equal(
        '<div style="color:green"></div>'
      );
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it('should set the rel attribute for <a> tags to "nofollow', () =&gt; {
      const a = '</a><a href="bar" rel="foo">Baz</a>';
      const expected = a.replace('foo', 'nofollow');
      expect(defaultSanitizer.sanitize(a)).to.equal(expected);
    });
github jupyterlab / jupyterlab / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it('should allow span tags and class attribute', () =&gt; {
      const span = '<span class="foo">bar</span>';
      expect(defaultSanitizer.sanitize(span)).to.equal(span);
    });