本文整理汇总了TypeScript中tinymce/core/api/dom/DOMUtils.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: function
suite.test('setGetAttrib', function () {
let dom;
DOM.add(document.body, 'div', { id : 'test' });
DOM.setAttrib('test', 'class', 'test 123');
LegacyUnit.equal(DOM.getAttrib('test', 'class'), 'test 123');
DOM.setAttrib('test', 'src', 'url');
LegacyUnit.equal(DOM.getAttrib('test', 'src'), 'url');
LegacyUnit.equal(DOM.getAttrib('test', 'data-mce-src'), 'url');
LegacyUnit.equal(DOM.getAttrib('test', 'abc'), '');
DOM.setAttribs('test', { class : '123', title : 'abc' });
LegacyUnit.equal(DOM.getAttrib('test', 'class'), '123');
LegacyUnit.equal(DOM.getAttrib('test', 'title'), 'abc');
DOM.setAttribs('test', {});
LegacyUnit.equal(DOM.getAttrib('test', 'class'), '123');
LegacyUnit.equal(DOM.getAttrib('test', 'title'), 'abc');
dom = DOMUtils(document, { keep_values : true, url_converter (u, n) {
return '&<>"' + u + '&<>"' + n;
} });
dom.setAttribs('test', { src : '123', href : 'abc' });
LegacyUnit.equal(DOM.getAttrib('test', 'src'), '&<>"123&<>"src');
LegacyUnit.equal(DOM.getAttrib('test', 'href'), '&<>"abc&<>"href');
LegacyUnit.equal(DOM.getAttrib(document, 'test'), '');
LegacyUnit.equal(DOM.getAttrib(document, 'test', ''), '');
LegacyUnit.equal(DOM.getAttrib(document, 'test', 'x'), 'x');
DOM.remove('test');
});
开发者ID:tinymce,项目名称:tinymce,代码行数:35,代码来源:DomUtilsTest.ts
示例2: function
UnitTest.asynctest('browser.tinymce.core.dom.TrimNodeTest', function () {
const success = arguments[arguments.length - 2];
const failure = arguments[arguments.length - 1];
const dom = DOMUtils(document, {});
const sTestTrim = function (inputHtml, expectedTrimmedHtml) {
return Step.sync(function () {
const elm = document.createElement('div');
elm.innerHTML = inputHtml;
TrimNode.trimNode(dom, elm.firstChild);
const actual = elm.innerHTML;
RawAssertions.assertEq('is correct trimmed html', expectedTrimmedHtml, actual);
});
};
const sTestTrimDocumentNode = Step.sync(function () {
const expected = document.implementation.createHTMLDocument('test');
const actual = TrimNode.trimNode(dom, expected);
RawAssertions.assertEq('Should return document as is', true, actual === expected);
});
Pipeline.async({}, [
sTestTrim('<p><span></span>x</p>', '<p>x</p>'),
sTestTrim('<p><span>x</span> </p>', '<p><span>x</span> </p>'),
sTestTrim('<p><span>x</span> <span>x</span></p>', '<p><span>x</span> <span>x</span></p>'),
sTestTrim('<p><span data-mce-type="bookmark"></span> y</p>', '<p><span data-mce-type="bookmark"></span> y</p>'),
sTestTrim('<p>a <span>b <span data-mce-type="bookmark"></span> c</span></p>', '<p>a <span>b <span data-mce-type="bookmark"></span> c</span></p>'),
sTestTrimDocumentNode
], function () {
success();
}, failure);
});
开发者ID:danielpunkass,项目名称:tinymce,代码行数:35,代码来源:TrimNodeTest.ts
示例3:
return Chain.mapper(function (viewBlock: any) {
const sc = Hierarchy.follow(Element.fromDom(viewBlock.get()), startPath).getOrDie();
const ec = Hierarchy.follow(Element.fromDom(viewBlock.get()), endPath).getOrDie();
const rng = document.createRange();
rng.setStart(sc.dom(), startOffset);
rng.setEnd(ec.dom(), endOffset);
return NormalizeRange.normalize(DOMUtils(document, { root_element: viewBlock.get() }), rng);
});
开发者ID:danielpunkass,项目名称:tinymce,代码行数:10,代码来源:NormalizeRangeTest.ts
示例4: DOMUtils
Logger.t('Normalize on document', Step.sync(function () {
const doc = document.implementation.createHTMLDocument('');
const rng = document.createRange();
const dom = DOMUtils(doc, { root_element: doc.body });
doc.body.innerHTML = '<p>a</p>';
rng.setStart(document, 0);
rng.setEnd(document, 0);
const normRng = NormalizeRange.normalize(dom, rng);
assertRange(doc.body, normRng, [0, 0], 0, [0, 0], 0);
}))
开发者ID:danielpunkass,项目名称:tinymce,代码行数:13,代码来源:NormalizeRangeTest.ts
注:本文中的tinymce/core/api/dom/DOMUtils.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论