From ed0c2ba14254b060aa04d465abdc1d07d6e932e3 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Wed, 22 Apr 2020 21:21:51 +1200 Subject: [PATCH] Lower psuedoclasses & namespaces throughout CSS selectors. Previously I just applied to them to the rightmost. --- src/Data/CSS/Preprocessor/PsuedoClasses.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Data/CSS/Preprocessor/PsuedoClasses.hs b/src/Data/CSS/Preprocessor/PsuedoClasses.hs index 37074ee..c9d6dc8 100644 --- a/src/Data/CSS/Preprocessor/PsuedoClasses.hs +++ b/src/Data/CSS/Preprocessor/PsuedoClasses.hs @@ -50,10 +50,14 @@ extractPseudoEl ps (Sibling sel _) = extractPseudoEl ps sel lowerSelector :: HashMap Text Text -> HashMap Text [Token] -> Selector -> Selector lowerSelector ns rewrites (Element sel') = Element $ lowerSelector' ns rewrites sel' -lowerSelector ns rewrites (Child p sel') = Child p $ lowerSelector' ns rewrites sel' -lowerSelector ns rewrites (Descendant p sel') = Descendant p $ lowerSelector' ns rewrites sel' -lowerSelector ns rewrites (Adjacent sib sel') = Adjacent sib $ lowerSelector' ns rewrites sel' -lowerSelector ns rewrites (Sibling sib sel') = Sibling sib $ lowerSelector' ns rewrites sel' +lowerSelector ns rewrites (Child p sel') = + Child (lowerSelector ns rewrites p) $ lowerSelector' ns rewrites sel' +lowerSelector ns rewrites (Descendant p sel') = + Descendant (lowerSelector ns rewrites p) $ lowerSelector' ns rewrites sel' +lowerSelector ns rewrites (Adjacent sib sel') = + Adjacent (lowerSelector ns rewrites sib) $ lowerSelector' ns rewrites sel' +lowerSelector ns rewrites (Sibling sib sel') = + Sibling (lowerSelector ns rewrites sib) $ lowerSelector' ns rewrites sel' lowerSelector' :: HashMap Text Text -> HashMap Text [Token] -> [SimpleSelector] -> [SimpleSelector] lowerSelector' namespaces' rewrites (Namespace ns:sels) = -- 2.30.2