How to use the @jupyterlab/apputils/src.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 yuvipanda / simplest-notebook / 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 yuvipanda / simplest-notebook / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it('should allow harmless inline CSS', () =&gt; {
      const div = '<div style="color:green;"></div>';
      expect(defaultSanitizer.sanitize(div)).to.equal(div);
    });
github yuvipanda / simplest-notebook / 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 yuvipanda / simplest-notebook / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it("should strip 'widows' properties from inline CSS", () =&gt; {
      const div = '<div style="widows: 2;"></div>';
      expect(defaultSanitizer.sanitize(div)).to.equal('<div></div>');
    });
github yuvipanda / simplest-notebook / 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 yuvipanda / simplest-notebook / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it('should not allow svg tags', () =&gt; {
      const svg = '<svg>foo</svg>';
      expect(defaultSanitizer.sanitize(svg)).to.equal('foo');
    });
github yuvipanda / simplest-notebook / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it("should strip 'counter-increment' properties from inline CSS", () =&gt; {
      const div = '<div style="counter-increment: example-counter;"></div>';
      expect(defaultSanitizer.sanitize(div)).to.equal('<div></div>');
    });
github yuvipanda / simplest-notebook / 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 yuvipanda / simplest-notebook / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it('should allow video tags with some attributes', () =&gt; {
      const video =
        '<video muted="" loop="" controls="" autoplay="" width="42" height="42" src="my/video.mp4"></video>';
      expect(defaultSanitizer.sanitize(video)).to.equal(video);
    });
github yuvipanda / simplest-notebook / tests / test-apputils / src / sanitizer.spec.ts View on Github external
it('should pass through simple well-formed whitelisted markup', () =&gt; {
      const div = '<div><p>Hello <b>there</b></p></div>';
      expect(defaultSanitizer.sanitize(div)).to.equal(div);
    });