本文整理汇总了TypeScript中@ephox/dom-globals.document.querySelectorAll方法的典型用法代码示例。如果您正苦于以下问题:TypeScript document.querySelectorAll方法的具体用法?TypeScript document.querySelectorAll怎么用?TypeScript document.querySelectorAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/dom-globals.document
的用法示例。
在下文中一共展示了document.querySelectorAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: default
export default () => {
const oldSink = document.querySelectorAll('.mce-silver-sink');
if (oldSink.length > 0) {
throw Error('old sinks found, a previous test did not call helpers.destroy() leaving artifacts, found: ' + oldSink.length);
}
const sink = GuiFactory.build({
dom: DomFactory.fromHtml('<div class="mce-silver-sink"></div>'),
behaviours: Behaviour.derive([
Positioning.config({
useFixed: true
})
])
});
const uiMothership = Gui.create();
Class.add(uiMothership.element(), 'tox');
const backstage = TestBackstage(sink);
const mockEditor = {
setContent: (content) => {},
insertContent: (content: string, args?: any) => {},
execCommand: (cmd: string, ui?: boolean, value?: any) => {}
} as Editor;
const extras = {
editor: mockEditor,
backstage
};
uiMothership.add(sink);
Attachment.attachSystem(Body.body(), uiMothership);
const destroy = () => {
uiMothership.remove(sink);
uiMothership.destroy();
};
return {
backstage,
shared: backstage.shared,
extras,
destroy,
uiMothership,
mockEditor
};
};
示例2: function
suite.asyncTest('target (each editor should have a different target)', function (_, done) {
const maxCount = document.querySelectorAll('.elm-even').length;
const elm1 = document.getElementById('elm-1');
let count = 0;
const targets = [];
EditorManager.init({
selector: '.elm-even',
target: elm1,
skin_url: '/project/js/tinymce/skins/lightgray',
init_instance_callback (ed) {
LegacyUnit.equal(ed.targetElm !== elm1, true, 'target option ignored');
LegacyUnit.equal(Tools.inArray(ed.targetElm, targets), -1);
targets.push(ed.targetElm);
if (++count >= maxCount) {
teardown(done);
}
}
});
});
示例3:
return Step.sync(function () {
const actual = document.querySelectorAll('.mce-menu-item').length;
RawAssertions.assertEq('Should be correct count', expected, actual);
});
示例4: function
const getSidebarElement = function (index) {
const sidebarPanelElms = document.querySelectorAll('.mce-sidebar-panel > .mce-container-body');
const flippedIndex = sidebarPanelElms.length - 1 - index;
return sidebarPanelElms ? sidebarPanelElms[flippedIndex] : null;
};