本文整理匯總了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>');
});