本文整理匯總了TypeScript中@ephox/sugar.SelectorExists類的典型用法代碼示例。如果您正苦於以下問題:TypeScript SelectorExists類的具體用法?TypeScript SelectorExists怎麽用?TypeScript SelectorExists使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了SelectorExists類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
Chain.binder((rect: ClientRect) => {
const middle = { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };
const range = document.caretRangeFromPoint(middle.x, middle.y);
if (! range) {
return Result.error('Could not find a range at coordinate: (' + middle.x + ', ' + middle.y + ')');
} else {
return SelectorExists.closest(Element.fromDom(range.startContainer), selector) ? Result.value(rect) : Result.error('Range was not within: "' + selector + '". Are you sure that it is on top of the dialog?');
}
})
示例2: function
const isPseudoStop = function (element) {
return SelectorExists.closest(element, [ '.' + beforeObject, '.' + afterObject ].join(','), Fun.constant(false));
};
示例3: function
const hasWhitespacePreserveParent = function (rootNode, node) {
const rootElement = Element.fromDom(rootNode);
const startNode = Element.fromDom(node);
return SelectorExists.ancestor(startNode, 'pre,code', Fun.curry(Compare.eq, rootElement));
};