本文整理匯總了TypeScript中@ephox/sugar.Compare.contains方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Compare.contains方法的具體用法?TypeScript Compare.contains怎麽用?TypeScript Compare.contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/sugar.Compare
的用法示例。
在下文中一共展示了Compare.contains方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getCollapsedNode
return getCollapsedNode(rng).bind(function (node) {
if (ElementType.isTableSection(node)) {
return Option.some(node);
} else if (Compare.contains(root, node) === false) {
return Option.some(root);
} else {
return Option.none();
}
});
示例2: dropLast
const parentsUntil = (start: Element, root: Element, predicate: (elm: Element) => boolean): Element[] => {
if (Compare.contains(root, start)) {
return dropLast(Traverse.parents(start, function (elm) {
return predicate(elm) || Compare.eq(elm, root);
}));
} else {
return [];
}
};
示例3: function
const parentsUntil = function (startNode, rootElm, predicate) {
if (Compare.contains(rootElm, startNode)) {
return dropLast(Traverse.parents(startNode, function (elm) {
return predicate(elm) || Compare.eq(elm, rootElm);
}));
} else {
return [];
}
};
示例4: function
const getInsertionPoint = function (fromBlock, toBlock) {
if (Compare.contains(toBlock, fromBlock)) {
return Traverse.parent(fromBlock).bind(function (parent) {
return Compare.eq(parent, toBlock) ? Option.some(fromBlock) : findParentInsertPoint(toBlock, fromBlock);
});
} else {
return Option.none();
}
};
示例5: function
const mergeLiElements = function (dom, fromElm, toElm) {
let node, listNode;
const ul = fromElm.parentNode;
if (!NodeType.isChildOfBody(dom, fromElm) || !NodeType.isChildOfBody(dom, toElm)) {
return;
}
if (NodeType.isListNode(toElm.lastChild)) {
listNode = toElm.lastChild;
}
if (ul === toElm.lastChild) {
if (NodeType.isBr(ul.previousSibling)) {
dom.remove(ul.previousSibling);
}
}
node = toElm.lastChild;
if (node && NodeType.isBr(node) && fromElm.hasChildNodes()) {
dom.remove(node);
}
if (NodeType.isEmpty(dom, toElm, true)) {
dom.$(toElm).empty();
}
moveChildren(dom, fromElm, toElm);
if (listNode) {
toElm.appendChild(listNode);
}
const contains = Compare.contains(Element.fromDom(toElm), Element.fromDom(fromElm));
const nestedLists = contains ? dom.getParents(fromElm, NodeType.isListNode, toElm) : [];
dom.remove(fromElm);
Arr.each(nestedLists, (list) => {
if (NodeType.isEmpty(dom, list) && list !== dom.getRoot()) {
dom.remove(list);
}
});
};
示例6: fromDomSafe
return fromDomSafe(rawContainer).map(function (container) {
return Compare.contains(Traverse.owner(container), container);
}).getOr(false);
示例7: function
const isOrContains = function (root, elm) {
return Compare.contains(root, elm) || Compare.eq(root, elm);
};
示例8: function
const getParentBlock = function (rootNode, elm) {
return Compare.contains(rootNode, elm) ? PredicateFind.closest(elm, function (element) {
return ElementType.isTextBlock(element) || ElementType.isListItem(element);
}, isBeforeRoot(rootNode)) : Option.none();
};
示例9: function
const isAttachedToDom = function (node) {
return !!(node && node.ownerDocument) && Compare.contains(Element.fromDom(node.ownerDocument), Element.fromDom(node));
};
示例10: findInsertionPoint
const getInsertionPoint = (fromBlock: Element, toBlock: Element): Option<Element> => {
return Compare.contains(toBlock, fromBlock) ? findInsertionPoint(toBlock, fromBlock) : Option.none();
};