@markuplint/ml-spec
Version:
Types and schema that specs of the Markup languages for markuplint
21 lines (20 loc) • 727 B
JavaScript
import { getSelectorsByContentModelCategory } from '../specs/get-selectors-by-content-model-category.js';
export function mayBeFocusable(
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
el, specs) {
return [
/**
* Interactive content
*
* @see https://html.spec.whatwg.org/multipage/dom.html#interactive-content
*/
...getSelectorsByContentModelCategory(specs, '#interactive'),
/**
* Interaction
*
* @see https://html.spec.whatwg.org/multipage/interaction.html
*/
'[tabindex]',
'[contenteditable]:not([contenteditable="false" i])',
].some(selector => el.matches(selector));
}