From d2f51c5e0a6f59e3310410538781738000d9872a Mon Sep 17 00:00:00 2001 From: Tommaso De Rossi Date: Sun, 9 Apr 2023 12:45:23 +0200 Subject: [PATCH 1/2] Update index.js --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 1b42b51..4a25723 100644 --- a/index.js +++ b/index.js @@ -42,8 +42,9 @@ module.exports = ({ function isAlreadyNested (rule) { let container = rule.parent - - while (container !== null && container.type !== 'root') { + let count = 0 + let max = 100 + while (container !== null && container.type !== 'root' && count < max) { if ( container.type === 'atrule' && container.params.includes('hover: hover') @@ -52,6 +53,7 @@ module.exports = ({ } container = container.parent + count += 1 } return false From 7e5be471e3afdc7e4ff0b5947f9ca93a25032a37 Mon Sep 17 00:00:00 2001 From: Tommaso De Rossi Date: Sun, 9 Apr 2023 12:47:29 +0200 Subject: [PATCH 2/2] Update index.js --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 4a25723..96a157c 100644 --- a/index.js +++ b/index.js @@ -44,7 +44,10 @@ module.exports = ({ let container = rule.parent let count = 0 let max = 100 - while (container !== null && container.type !== 'root' && count < max) { + while (container !== null && container.type !== 'root') { + if (count > max) { + return true + } if ( container.type === 'atrule' && container.params.includes('hover: hover')