當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript DOM.create方法代碼示例

本文整理匯總了TypeScript中tinymce/core/dom/DOMUtils.DOM.create方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript DOM.create方法的具體用法?TypeScript DOM.create怎麽用?TypeScript DOM.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tinymce/core/dom/DOMUtils.DOM的用法示例。


在下文中一共展示了DOM.create方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

 suite.test('isUIElement on valid element', function (editor) {
   const uiElm1 = DOMUtils.DOM.create('div', { class: 'mce-abc' }, null);
   const uiElm2 = DOMUtils.DOM.create('div', { class: 'mcex-abc' }, null);
   const noUiElm = DOMUtils.DOM.create('div', { class: 'mcey-abc' }, null);
   editor.settings.custom_ui_selector = '.mcex-abc';
   LegacyUnit.equal(FocusController.isUIElement(editor, uiElm1), true, 'Should be true since mce- is a ui prefix');
   LegacyUnit.equal(FocusController.isUIElement(editor, uiElm2), true, 'Should be true since mcex- is a ui prefix');
   LegacyUnit.equal(FocusController.isUIElement(editor, noUiElm), false, 'Should be true since mcey- is not a ui prefix');
   delete editor.settings.custom_ui_selector;
 });
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:10,代碼來源:FocusControllerTest.ts

示例2: function

export default function () {
  const domElm = DOMUtils.DOM.create('div', {
    style: 'position: absolute; right: 10px; top: 10px;'
  });

  const attach = function (preventDuplicates?) {
    if (preventDuplicates && domElm.parentNode === document.body) {
      detach();
    }
    document.body.appendChild(domElm);
  };

  const detach = function () {
    DOMUtils.DOM.remove(domElm);
  };

  const update = function (html) {
    DOMUtils.DOM.setHTML(domElm, html);
  };

  const get = function () {
    return domElm;
  };

  return {
    attach,
    update,
    detach,
    get
  };
}
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:31,代碼來源:ViewBlock.ts

示例3: function

const load = function (doc, url) {
  const linkElements = Tools.toArray(doc.getElementsByTagName('link'));
  const matchingLinkElms = Tools.grep(linkElements, function (head) {
    return head.id === cssId;
  });

  if (matchingLinkElms.length === 0) {
    const linkElm = DOMUtils.DOM.create('link', {
      id: cssId,
      rel: 'stylesheet',
      href: url
    });

    doc.getElementsByTagName('head')[0].appendChild(linkElm);
  }
};
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:16,代碼來源:LoadCss.ts


注:本文中的tinymce/core/dom/DOMUtils.DOM.create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。