mirror of
https://github.com/sern-handler/website
synced 2026-06-27 02:02:23 +00:00
23 lines
484 B
JavaScript
23 lines
484 B
JavaScript
/**
|
|
* @typedef {import('css-selector-parser').AstTagName} AstTagName
|
|
*
|
|
* @typedef {import('hast').Element} Element
|
|
*/
|
|
|
|
// Workaround to show references to above types in VS Code.
|
|
''
|
|
|
|
/**
|
|
* Check whether an element has a tag name.
|
|
*
|
|
* @param {AstTagName} query
|
|
* AST rule (with `tag`).
|
|
* @param {Element} element
|
|
* Element.
|
|
* @returns {boolean}
|
|
* Whether `element` matches `query`.
|
|
*/
|
|
export function name(query, element) {
|
|
return query.name === element.tagName
|
|
}
|