~alcinnz/haskell-stylist

ed0c2ba14254b060aa04d465abdc1d07d6e932e3 — Adrian Cochrane 4 years ago cae4f2e
Lower psuedoclasses & namespaces throughout CSS selectors.

Previously I just applied to them to the rightmost.
1 files changed, 8 insertions(+), 4 deletions(-)

M src/Data/CSS/Preprocessor/PsuedoClasses.hs
M src/Data/CSS/Preprocessor/PsuedoClasses.hs => src/Data/CSS/Preprocessor/PsuedoClasses.hs +8 -4
@@ 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) =