本文整理匯總了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'));