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


TypeScript document.getElementById方法代码示例

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


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

示例1: function

 suite.test('create deep element index', function () {
   setupHtml('<p><span>a</span><span><b id="a"></b><b id="b"></b><b id="c"></b></span></p>');
   LegacyUnit.equal(CaretBookmark.create(getRoot(), CaretPosition.before(document.getElementById('a'))), 'p[0]/span[1]/b[0],before');
   LegacyUnit.equal(CaretBookmark.create(getRoot(), CaretPosition.before(document.getElementById('b'))), 'p[0]/span[1]/b[1],before');
   LegacyUnit.equal(CaretBookmark.create(getRoot(), CaretPosition.before(document.getElementById('c'))), 'p[0]/span[1]/b[2],before');
   LegacyUnit.equal(CaretBookmark.create(getRoot(), CaretPosition.after(document.getElementById('c'))), 'p[0]/span[1]/b[2],after');
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:CaretBookmarkTest.ts

示例2: function

  suite.asyncTest('target (selector option takes precedence over target option)', function (_, done) {
    const elm1 = document.getElementById('elm-1');
    const elm2 = document.getElementById('elm-2');

    EditorManager.init({
      selector: '#elm-2',
      target: elm1,
      skin_url: '/project/js/tinymce/skins/lightgray',
      init_instance_callback (ed) {
        LegacyUnit.equalDom(ed.targetElm, elm2);
        teardown(done);
      }
    });
  });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:14,代码来源:EditorInitializationTest.ts

示例3: function

  suite.test('Image recognizes relative src url and prepends absolute image_prepend_url setting.', function (editor) {
    let win, elementId, element;

    editor.settings.image_prepend_url = 'http://abc.local/images/';
    editor.setContent('');
    editor.execCommand('mceImage', true);

    const data = {
      src: 'src',
      alt: 'alt'
    };

    win = getFrontmostWindow(editor);
    elementId = win.find('#src')[0]._id;
    element = document.getElementById(elementId).childNodes[0];

    win.fromJSON(data);
    triggerElementChange(element);

    win.find('form')[0].submit();
    win.close();

    LegacyUnit.equal(
      cleanHtml(editor.getContent()),
      '<p><img src="' + editor.settings.image_prepend_url + 'src" alt="alt" /></p>'
    );
  });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:27,代码来源:ImagePluginTest.ts

示例4: function

  const fireFormatsMenuEvent = function (editor: Editor, styleSheets, items?) {
    menuCtrl = Factory.create('menu', {
      items
    }).renderTo(document.getElementById('view'));

    return editor.fire('renderFormatsMenu', {
      control: menuCtrl,
      doc: {
        styleSheets
      }
    });
  };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:12,代码来源:ImportCssPluginTest.ts

示例5: function

  suite.test('hide save content and hidden state while saving', function (editor) {
    let lastEvent, hiddenStateWhileSaving;

    editor.on('SaveContent', function (e) {
      lastEvent = e;
      hiddenStateWhileSaving = editor.isHidden();
    });

    editor.setContent('xyz');
    editor.hide();

    const elm: any = document.getElementById(editor.id);
    LegacyUnit.equal(hiddenStateWhileSaving, false, 'False isHidden state while saving');
    LegacyUnit.equal(lastEvent.content, '<p>xyz</p>');
    LegacyUnit.equal(elm.value, '<p>xyz</p>');

    editor.show();
  });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:18,代码来源:EditorTest.ts

示例6:

 const dumpSource = (editor) => {
   const textArea = document.getElementById('source') as HTMLTextAreaElement;
   const raw = document.getElementById('raw') as HTMLInputElement;
   textArea.value = raw.checked ? editor.getBody().innerHTML : editor.getContent();
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:5,代码来源:SourceDumpDemo.ts

示例7: cFindInDialog

const cFindTextarea = cFindInDialog(function (value) {
  return document.getElementById(value.dom().htmlFor);
});
开发者ID:danielpunkass,项目名称:tinymce,代码行数:3,代码来源:Utils.ts


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