本文整理汇总了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');
});
示例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);
}
});
});
示例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>'
);
});
示例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
}
});
};
示例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();
});
示例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();
};
示例7: cFindInDialog
const cFindTextarea = cFindInDialog(function (value) {
return document.getElementById(value.dom().htmlFor);
});