当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript document.querySelectorAll方法代码示例

本文整理汇总了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
  };
};
开发者ID:tinymce,项目名称:tinymce,代码行数:49,代码来源:TestExtras.ts

示例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);
        }
      }
    });
  });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:22,代码来源:EditorInitializationTest.ts

示例3:

 return Step.sync(function () {
   const actual = document.querySelectorAll('.mce-menu-item').length;
   RawAssertions.assertEq('Should be correct count', expected, actual);
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:4,代码来源:FontsizeFormatTest.ts

示例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;
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:5,代码来源:SidebarTest.ts


注:本文中的@ephox/dom-globals.document.querySelectorAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。