mirror of
https://github.com/OliveTin/OliveTin
synced 2025-12-18 03:55:32 +00:00
23 lines
635 B
JavaScript
23 lines
635 B
JavaScript
import findNodeUpToRoot from './findNodeUpToRoot.mjs';
|
|
import { isAtRule } from './typeGuards.mjs';
|
|
import { nestingSupportedAtKeywords } from '../reference/atKeywords.mjs';
|
|
|
|
/** @import { Declaration, Node } from 'postcss' */
|
|
|
|
/**
|
|
* Check whether a declaration is a descriptor one
|
|
*
|
|
* @param {Declaration} decl
|
|
* @returns {boolean}
|
|
*/
|
|
export default function isDescriptorDeclaration(decl) {
|
|
return Boolean(findNodeUpToRoot(decl, isAtRuleSupportingDescriptors));
|
|
}
|
|
|
|
/**
|
|
* @param {Node} node
|
|
*/
|
|
function isAtRuleSupportingDescriptors(node) {
|
|
return isAtRule(node) && !nestingSupportedAtKeywords.has(node.name.toLowerCase());
|
|
}
|