本文整理汇总了TypeScript中tinymce/core/api/dom/DOMUtils.DOM.hasClass方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM.hasClass方法的具体用法?TypeScript DOM.hasClass怎么用?TypeScript DOM.hasClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tinymce/core/api/dom/DOMUtils.DOM
的用法示例。
在下文中一共展示了DOM.hasClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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'
);
});
示例2: 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?) {