1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- 'use strict';
- function checkMatch(nodeA, nodeB) {
- if (nodeA.type === 'atrule' && nodeB.type === 'atrule') {
- return (
- nodeA.params === nodeB.params &&
- nodeA.name.toLowerCase() === nodeB.name.toLowerCase()
- );
- }
- return nodeA.type === nodeB.type;
- }
- function sameParent(nodeA, nodeB) {
- if (!nodeA.parent) {
-
- return !nodeB.parent;
- }
- if (!nodeB.parent) {
-
- return false;
- }
-
- if (!checkMatch(nodeA.parent, nodeB.parent)) {
- return false;
- }
-
- return sameParent(nodeA.parent, nodeB.parent);
- }
- module.exports = sameParent;
|