postcss-hover-media-feature icon indicating copy to clipboard operation
postcss-hover-media-feature copied to clipboard

fix: infinite loop when :hover is contained in :has or nested :not selector

Open dtdesign opened this issue 11 months ago • 0 comments

The previous fix for :not() in 3433c7da7bf759ea435681ad3bd3e13f5c99375e was incomplete because it only considered :hover as a standalone selector but missed the ability to combine it with other selectors like :not(.some-class:hover), yielding an infinite loop once again.

The same problem exists for :has() and since it follows the same semantics, I went ahead and unified the approach for both pseudo selectors. For complex selectors the :not() or :has() is not the immediate parent, requiring a recursive lookup to identify any such selectors.

Fixes #35

dtdesign avatar Apr 07 '25 12:04 dtdesign