本文整理汇总了TypeScript中@jupyterlab/apputils.defaultSanitizer.sanitize方法的典型用法代码示例。如果您正苦于以下问题:TypeScript defaultSanitizer.sanitize方法的具体用法?TypeScript defaultSanitizer.sanitize怎么用?TypeScript defaultSanitizer.sanitize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@jupyterlab/apputils.defaultSanitizer
的用法示例。
在下文中一共展示了defaultSanitizer.sanitize方法的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>');
});