本文整理汇总了TypeScript中@jupyterlab/apputils.defaultSanitizer类的典型用法代码示例。如果您正苦于以下问题:TypeScript defaultSanitizer类的具体用法?TypeScript defaultSanitizer怎么用?TypeScript defaultSanitizer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了defaultSanitizer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should allow input tags but disable them', () => {
let html = defaultSanitizer.sanitize('<input type="checkbox" checked />');
let div = document.createElement('div');
let input: HTMLInputElement;
div.innerHTML = html;
input = div.querySelector('input');
expect(input.disabled).to.be(true);
});
示例2: it
it('should allow the class attribute for code tags', () => {
const code = '<code class="foo">bar</code>';
expect(defaultSanitizer.sanitize(code)).to.equal(code);
});
示例3: it
it('should allow the class attribute for p tags', () => {
let p = '<p class="foo">bar</p>';
expect(defaultSanitizer.sanitize(p)).to.be(p);
});
示例4: it
it("should strip 'orphans' properties from inline CSS", () => {
const div = '<div style="orphans: 3;"></div>';
expect(defaultSanitizer.sanitize(div)).to.equal('<div></div>');
});