本文整理汇总了TypeScript中@ephox/sugar.Attr.has方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Attr.has方法的具体用法?TypeScript Attr.has怎么用?TypeScript Attr.has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/sugar.Attr
的用法示例。
在下文中一共展示了Attr.has方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const getAttr = (c, property: string): Option<any> => {
if (Attr.has(c, property)) {
return Option.some(Attr.get(c, property));
} else {
return Option.none();
}
};
示例2:
const cGetDialogLabelId = Chain.binder((dialogE: Element) => {
if (Attr.has(dialogE, 'aria-labelledby')) {
const labelId = Attr.get(dialogE, 'aria-labelledby');
return labelId.length > 0 ? Result.value(labelId) : Result.error('Dialog has zero length aria-labelledby attribute');
} else {
return Result.error('Dialog has no aria-labelledby attribute');
}
});
示例3: Error
Chain.op((dialog) => {
if (Attr.has(dialog, 'aria-labelledby')) {
const labelledby = Attr.get(dialog, 'aria-labelledby');
const dialogLabel = SelectorFind.descendant(dialog, '#' + labelledby).getOrDie('Could not find labelledby');
Assertions.assertEq('Checking label text', ariaLabel, Html.get(dialogLabel));
} else {
throw new Error('Dialog did not have an aria-labelledby');
}
})
示例4:
return Step.sync(() => {
Assertions.assertEq('Checking if disabled attr is present: ' + label, expected, Attr.has(button.element(), 'disabled'));
});
示例5: function
const checkLast = function (last) {
return !Attr.has(last, 'data-mce-bogus') && Node.name(last) !== 'br' && !(Node.isText(last) && Text.get(last).length === 0);
};
示例6:
const sAssertNoDataStyle = (editor, path) => Step.sync(() => {
const element = Hierarchy.follow(Element.fromDom(editor.getBody()), path).getOrDie('could not find element');
const hasDataStyle = Attr.has(element, 'data-mce-style');
RawAssertions.assertEq('should not have data style', false, hasDataStyle);
});
示例7: function
const hasSpan = function (elem) {
return (Attr.has(elem, 'rowspan') && parseInt(Attr.get(elem, 'rowspan'), 10) > 1) ||
(Attr.has(elem, 'colspan') && parseInt(Attr.get(elem, 'colspan'), 10) > 1);
};
示例8:
return elm.forall((elm) => Attr.has(elm, 'disabled'));