You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
347 B
15 lines
347 B
module.exports = function getContainingNode(node) {
|
|
// For styled-components declarations are children of Root node
|
|
if (
|
|
node.type !== 'rule' &&
|
|
node.type !== 'atrule' &&
|
|
node.parent.document &&
|
|
node.parent.document.nodes &&
|
|
node.parent.document.nodes.some(item => item.type === 'root')
|
|
) {
|
|
return node.parent;
|
|
}
|
|
|
|
return node;
|
|
};
|