本文整理汇总了TypeScript中wed/domutil.firstDescendantOrSelf函数的典型用法代码示例。如果您正苦于以下问题:TypeScript firstDescendantOrSelf函数的具体用法?TypeScript firstDescendantOrSelf怎么用?TypeScript firstDescendantOrSelf使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了firstDescendantOrSelf函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("returns the first descendant", () => {
const node = root;
assert.isNotNull(node); // make sure we got something
assert.isDefined(node); // make sure we got something
assert.equal(domutil.firstDescendantOrSelf(node),
root.getElementsByTagName("title")[0].firstChild);
});
示例2: it
it("moves the caret to the previous line", () => {
// Text node inside 2nd paragraph.
const initial = editor.dataRoot.querySelectorAll("body>p")[1];
caretManager.setCaret(initial.firstChild, 0);
editor.type(keyConstants.UP_ARROW);
// We end up in the previous paragraph.
dataCaretCheck(editor,
firstDescendantOrSelf(initial.previousElementSibling)!,
0, "moved up");
});