eslint-plugin-lit-a11y
Version:
linting plugin for lit-a11y
20 lines (17 loc) • 564 B
JavaScript
/**
* Does the element have the attribute?
* @param {import("parse5-htmlparser2-tree-adapter").Element} element
* @param {string} attr
*/
function elementHasAttribute(element, attr) {
return Object.keys(element.attribs).includes(attr);
}
/**
* Does the element have the attribute?
* @param {import("parse5-htmlparser2-tree-adapter").Element} element
* @param {string[]} attrs
*/
function elementHasSomeAttribute(element, attrs) {
return attrs.some(elementHasAttribute.bind(attrs, element));
}
export { elementHasAttribute, elementHasSomeAttribute };