@@ 9,7 9,7 @@ import Data.CSS.Syntax.Selector
import Data.CSS.Syntax.Tokens
import Data.Text as Txt
-import Data.Maybe (fromMaybe)
+import Data.Maybe (fromMaybe, listToMaybe)
import Data.HashMap.Lazy as HM
import Data.Function ((&))
@@ 40,13 40,13 @@ lowerRule LowerPsuedoClasses { namespaces = ns, rewriteRules = rewrites } (Style
StyleRule (lowerSelector ns rewrites sel) props pseudoel
extractPseudoEl :: [Text] -> Selector -> Maybe Text
-extractPseudoEl ps (Element sel)
- | (pseudo:_) <- [p | Psuedoclass p [] <- sel, p `elem` ps] = Just pseudo
- | otherwise = Nothing
-extractPseudoEl ps (Child sel _) = extractPseudoEl ps sel
-extractPseudoEl ps (Descendant sel _) = extractPseudoEl ps sel
-extractPseudoEl ps (Adjacent sel _) = extractPseudoEl ps sel
-extractPseudoEl ps (Sibling sel _) = extractPseudoEl ps sel
+extractPseudoEl ps (Element sel) = extractPseudoEl' ps sel
+extractPseudoEl ps (Child _ sel) = extractPseudoEl' ps sel
+extractPseudoEl ps (Descendant _ sel) = extractPseudoEl' ps sel
+extractPseudoEl ps (Adjacent _ sel) = extractPseudoEl' ps sel
+extractPseudoEl ps (Sibling _ sel) = extractPseudoEl' ps sel
+extractPseudoEl' :: [Text] -> [SimpleSelector] -> Maybe Text
+extractPseudoEl' ps sel = listToMaybe [p | Psuedoclass p [] <- sel, p `elem` ps]
lowerSelector :: HashMap Text Text -> HashMap Text [Token] -> Selector -> Selector
lowerSelector ns rewrites (Element sel') = Element $ lowerSelector' ns rewrites sel'