| Stability | provisional |
|---|---|
| Safe Haskell | Safe |
| Language | Haskell2010 |
Text.XML.HXT.CSS.TypeDefs
Description
Data types for the abstract syntax tree of CSS selectors. We (mostly) follow the naming conventions of the CSS Level 3 specification document (http://www.w3.org/TR/css3-selectors/). The type hierarchy tries to strike a balance between correctness and complexity. As a result, it is possible to construct values that correspond to invalid selectors. For example,
Negation(NegationUniversalSelector)
is not valid according to the spec, as double negation is not allowed.
Note that parseCSS never produces invalid
selectors.
Synopsis
- newtype SelectorsGroup = SelectorsGroup [Selector]
- data Selector
- newtype SimpleSelectorSeq = SimpleSelectorSeq [SimpleSelector]
- data SimpleSelector
- data AttrTest
- data PseudoClass
- data PseudoNthClass
- data Nth
- findPseudoClass :: String -> Maybe PseudoClass
- findPseudoNthClass :: String -> Maybe (Nth -> PseudoNthClass)
- testNth :: Nth -> Int -> Bool
Documentation
newtype SelectorsGroup #
The top-level selector type.
Constructors
| SelectorsGroup [Selector] | E, F |
Instances
| Eq SelectorsGroup # | |
Defined in Text.XML.HXT.CSS.TypeDefs Methods (==) :: SelectorsGroup -> SelectorsGroup -> Bool # (/=) :: SelectorsGroup -> SelectorsGroup -> Bool # | |
| Show SelectorsGroup # | |
Defined in Text.XML.HXT.CSS.TypeDefs Methods showsPrec :: Int -> SelectorsGroup -> ShowS # show :: SelectorsGroup -> String # showList :: [SelectorsGroup] -> ShowS # | |
| Css SelectorsGroup # | |
Defined in Text.XML.HXT.CSS Methods selectDeep :: ArrowXml a => SelectorsGroup -> a XmlNavTree XmlNavTree select :: ArrowXml a => SelectorsGroup -> a XmlNavTree XmlNavTree | |
Constructors
| Selector SimpleSelectorSeq | E |
| Descendant SimpleSelectorSeq Selector | E F |
| Child SimpleSelectorSeq Selector | E > F |
| AdjSibling SimpleSelectorSeq Selector | E + F |
| FolSibling SimpleSelectorSeq Selector | E ~ F |
Instances
| Eq Selector # | |
| Show Selector # | |
| Css Selector # | |
Defined in Text.XML.HXT.CSS Methods selectDeep :: ArrowXml a => Selector -> a XmlNavTree XmlNavTree select :: ArrowXml a => Selector -> a XmlNavTree XmlNavTree | |
newtype SimpleSelectorSeq #
Constructors
| SimpleSelectorSeq [SimpleSelector] | tag#id.class:pseudo |
Instances
| Eq SimpleSelectorSeq # | |
Defined in Text.XML.HXT.CSS.TypeDefs Methods (==) :: SimpleSelectorSeq -> SimpleSelectorSeq -> Bool # (/=) :: SimpleSelectorSeq -> SimpleSelectorSeq -> Bool # | |
| Show SimpleSelectorSeq # | |
Defined in Text.XML.HXT.CSS.TypeDefs Methods showsPrec :: Int -> SimpleSelectorSeq -> ShowS # show :: SimpleSelectorSeq -> String # showList :: [SimpleSelectorSeq] -> ShowS # | |
| Css SimpleSelectorSeq # | |
Defined in Text.XML.HXT.CSS Methods selectDeep :: ArrowXml a => SimpleSelectorSeq -> a XmlNavTree XmlNavTree select :: ArrowXml a => SimpleSelectorSeq -> a XmlNavTree XmlNavTree | |
data SimpleSelector #
Constructors
| UniversalSelector | * |
| TypeSelector String | tag |
| IdSelector String | #id |
| ClassSelector String | .class |
| AttrSelector String AttrTest | [..] |
| Pseudo PseudoClass | :pseudo |
| PseudoNth PseudoNthClass | :pseudo(2) |
| Negation SimpleSelector | :not(..) |
Instances
| Eq SimpleSelector # | |
Defined in Text.XML.HXT.CSS.TypeDefs Methods (==) :: SimpleSelector -> SimpleSelector -> Bool # (/=) :: SimpleSelector -> SimpleSelector -> Bool # | |
| Show SimpleSelector # | |
Defined in Text.XML.HXT.CSS.TypeDefs Methods showsPrec :: Int -> SimpleSelector -> ShowS # show :: SimpleSelector -> String # showList :: [SimpleSelector] -> ShowS # | |
| Css SimpleSelector # | |
Defined in Text.XML.HXT.CSS Methods selectDeep :: ArrowXml a => SimpleSelector -> a XmlNavTree XmlNavTree select :: ArrowXml a => SimpleSelector -> a XmlNavTree XmlNavTree | |
Constructors
| AttrExists | [attr] |
| AttrEq String | [attr=var] |
| AttrContainsSp String | [attr~=var] |
| AttrBeginHy String | [attr|=var] |
| AttrPrefix String | [attr^=var] |
| AttrSuffix String | [attr$=var] |
| AttrSubstr String | [attr*=var] |
data PseudoClass #
Pseudo classes.
Constructors
| PseudoFirstChild | :first-child |
| PseudoLastChild | :last-child |
| PseudoOnlyChild | :only-child |
| PseudoFirstOfType | :first-of-type |
| PseudoLastOfType | :last-of-type |
| PseudoOnlyOfType | :only-of-type |
| PseudoEmpty | :empty |
| PseudoRoot | :root |
Instances
| Eq PseudoClass # | |
Defined in Text.XML.HXT.CSS.TypeDefs | |
| Show PseudoClass # | |
Defined in Text.XML.HXT.CSS.TypeDefs Methods showsPrec :: Int -> PseudoClass -> ShowS # show :: PseudoClass -> String # showList :: [PseudoClass] -> ShowS # | |
| Css PseudoClass # | |
Defined in Text.XML.HXT.CSS Methods selectDeep :: ArrowXml a => PseudoClass -> a XmlNavTree XmlNavTree select :: ArrowXml a => PseudoClass -> a XmlNavTree XmlNavTree | |
data PseudoNthClass #
Pseudo classes that expect a argument of type Nth.
Constructors
| PseudoNthChild Nth | :nth-child(..) |
| PseudoNthLastChild Nth | :nth-last-child(..) |
| PseudoNthOfType Nth | :nth-of-type(..) |
| PseudoNthLastOfType Nth | :nth-last-of-type(..) |
Instances
| Eq PseudoNthClass # | |
Defined in Text.XML.HXT.CSS.TypeDefs Methods (==) :: PseudoNthClass -> PseudoNthClass -> Bool # (/=) :: PseudoNthClass -> PseudoNthClass -> Bool # | |
| Show PseudoNthClass # | |
Defined in Text.XML.HXT.CSS.TypeDefs Methods showsPrec :: Int -> PseudoNthClass -> ShowS # show :: PseudoNthClass -> String # showList :: [PseudoNthClass] -> ShowS # | |
| Css PseudoNthClass # | |
Defined in Text.XML.HXT.CSS Methods selectDeep :: ArrowXml a => PseudoNthClass -> a XmlNavTree XmlNavTree select :: ArrowXml a => PseudoNthClass -> a XmlNavTree XmlNavTree | |
Type of the argument of the :nth-child (PseudoNthClass)
family of pseudo classes. matches with all integers that can
be written in the form Nth a ban+b for some nonnegative integer n.
findPseudoClass :: String -> Maybe PseudoClass #
Find a PseudoClass given its name (without the colon).
findPseudoNthClass :: String -> Maybe (Nth -> PseudoNthClass) #
Find a PseudoNthClass given its name (without the colon).