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


TypeScript DOM.hasClass方法代码示例

本文整理汇总了TypeScript中tinymce/core/dom/DOMUtils.DOM.hasClass方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM.hasClass方法的具体用法?TypeScript DOM.hasClass怎么用?TypeScript DOM.hasClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tinymce/core/dom/DOMUtils.DOM的用法示例。


在下文中一共展示了DOM.hasClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: get

  },

  get (id) {
    return document.getElementById(id);
  },

  addClass (elm, cls) {
    return DOMUtils.DOM.addClass(elm, cls);
  },

  removeClass (elm, cls) {
    return DOMUtils.DOM.removeClass(elm, cls);
  },

  hasClass (elm, cls) {
    return DOMUtils.DOM.hasClass(elm, cls);
  },

  toggleClass (elm, cls, state) {
    return DOMUtils.DOM.toggleClass(elm, cls, state);
  },

  css (elm, name, value?) {
    return DOMUtils.DOM.setStyle(elm, name, value);
  },

  getRuntimeStyle (elm, name) {
    return DOMUtils.DOM.getStyle(elm, name, true);
  },

  on (target, name, callback, scope?) {
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:31,代码来源:DomUtils.ts

示例2: function

  suite.test('Fullscreen class on html and body tag', function (editor) {
    const bodyTag = document.body;
    const htmlTag = document.documentElement;
    let lastEventArgs;

    editor.on('FullscreenStateChanged', function (e) {
      lastEventArgs = e;
    });

    LegacyUnit.equal(
      DOMUtils.DOM.hasClass(bodyTag, 'mce-fullscreen'),
      false,
      'Body tag should not have "mce-fullscreen" class before fullscreen command'
    );
    LegacyUnit.equal(
      DOMUtils.DOM.hasClass(htmlTag, 'mce-fullscreen'),
      false,
      'Html tag should not have "mce-fullscreen" class before fullscreen command'
    );

    editor.execCommand('mceFullScreen');

    LegacyUnit.equal(editor.plugins.fullscreen.isFullscreen(), true, 'Should be true');
    LegacyUnit.equal(lastEventArgs.state, true, 'Should be true');

    LegacyUnit.equal(
      DOMUtils.DOM.hasClass(bodyTag, 'mce-fullscreen'),
      true,
      'Body tag should have "mce-fullscreen" class after fullscreen command'
    );
    LegacyUnit.equal(
      DOMUtils.DOM.hasClass(htmlTag, 'mce-fullscreen'),
      true,
      'Html tag should have "mce-fullscreen" class after fullscreen command'
    );

    editor.execCommand('mceLink', true);

    const windows = editor.windowManager.getWindows();
    const linkWindow = windows[0];

    LegacyUnit.equal(typeof linkWindow, 'object', 'Link window is an object');

    linkWindow.close();

    LegacyUnit.equal(windows.length, 0, 'No windows exist');

    LegacyUnit.equal(
      DOMUtils.DOM.hasClass(bodyTag, 'mce-fullscreen'),
      true,
      'Body tag should still have "mce-fullscreen" class after window is closed'
    );
    LegacyUnit.equal(
      DOMUtils.DOM.hasClass(htmlTag, 'mce-fullscreen'),
      true,
      'Html tag should still have "mce-fullscreen" class after window is closed'
    );

    editor.execCommand('mceFullScreen');

    LegacyUnit.equal(editor.plugins.fullscreen.isFullscreen(), false, 'Should be false');
    LegacyUnit.equal(lastEventArgs.state, false, 'Should be false');
    LegacyUnit.equal(
      DOMUtils.DOM.hasClass(bodyTag, 'mce-fullscreen'),
      false,
      'Body tag should have "mce-fullscreen" class after fullscreen command'
    );
    LegacyUnit.equal(
      DOMUtils.DOM.hasClass(htmlTag, 'mce-fullscreen'),
      false,
      'Html tag should have "mce-fullscreen" class after fullscreen command'
    );
  });
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:73,代码来源:FullScreenPluginTest.ts


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