Safe Haskell | None |
---|---|
Language | Haskell2010 |
Parses CSS selectors
See parseSelectors
Synopsis
- data Selector
- data SimpleSelector
- data PropertyTest
- data PropertyFunc = PropertyFunc (String -> Bool)
- parseSelectors :: Parser [Selector]
Documentation
A CSS "selector" indicating which elements should be effected by CSS.
Element [SimpleSelector] | Selects a single element. |
Child Selector [SimpleSelector] | Represents "a > b" operator. |
Descendant Selector [SimpleSelector] | Represents "a b" operator. |
Adjacent Selector [SimpleSelector] | Represents "a + b" operator. |
Sibling Selector [SimpleSelector] | Represents "a ~ b" operator. |
Instances
data SimpleSelector Source #
An individual test comprising a CSS stylesheet.
Tag Text | Matches a tagname, e.g. "a" |
Namespace Text | |
Id Text | Matches the "id" attribute, e.g. "#header" |
Class Text | Matches the "class" attribute, e.g. ".ad" |
Property (Maybe Text) Text PropertyTest | Matches a specified property |
Psuedoclass Text [Token] | Matches psuedoclasses provided by the caller (via a nameless property). |
Instances
Eq SimpleSelector Source # | |
Defined in Data.CSS.Syntax.Selector (==) :: SimpleSelector -> SimpleSelector -> Bool # (/=) :: SimpleSelector -> SimpleSelector -> Bool # | |
Show SimpleSelector Source # | |
Defined in Data.CSS.Syntax.Selector showsPrec :: Int -> SimpleSelector -> ShowS # show :: SimpleSelector -> String # showList :: [SimpleSelector] -> ShowS # | |
Hashable SimpleSelector Source # | |
Defined in Data.CSS.Style.Selector.Index hashWithSalt :: Int -> SimpleSelector -> Int # hash :: SimpleSelector -> Int # |
data PropertyTest Source #
How should a property be matched.
Exists | Matches whether an attribute actually exists, e.g. "[title]" |
Equals Text | Matches whether the attribute is exactly equal to the value, e.g. "=" |
Suffix Text | Matches whether attribute ends with the given value, e.g. "$=" |
Prefix Text | Matches whether attribute starts with the given value, e.g. "^=" |
Substring Text | Matches whether the attribute contains the given value, e.g. "*=" |
Include Text | Is one of the whitespace-seperated values the one specified? e.g. "~=" |
Dash Text | Matches whitespace seperated values, or their "-"-seperated prefixes. e.g. "|=" |
Callback PropertyFunc | Calls the given function to test this property. |
Instances
Eq PropertyTest Source # | |
Defined in Data.CSS.Syntax.Selector (==) :: PropertyTest -> PropertyTest -> Bool # (/=) :: PropertyTest -> PropertyTest -> Bool # | |
Show PropertyTest Source # | |
Defined in Data.CSS.Syntax.Selector showsPrec :: Int -> PropertyTest -> ShowS # show :: PropertyTest -> String # showList :: [PropertyTest] -> ShowS # | |
Hashable PropertyTest Source # | |
Defined in Data.CSS.Style.Selector.Index hashWithSalt :: Int -> PropertyTest -> Int # hash :: PropertyTest -> Int # |
data PropertyFunc Source #
Caller-specified functions to extend property selection. Has incorrect Show/Eq implementations so this rare exception doesn't break things.
PropertyFunc (String -> Bool) |
Instances
Eq PropertyFunc Source # | |
Defined in Data.CSS.Syntax.Selector (==) :: PropertyFunc -> PropertyFunc -> Bool # (/=) :: PropertyFunc -> PropertyFunc -> Bool # | |
Show PropertyFunc Source # | |
Defined in Data.CSS.Syntax.Selector showsPrec :: Int -> PropertyFunc -> ShowS # show :: PropertyFunc -> String # showList :: [PropertyFunc] -> ShowS # |
parseSelectors :: Parser [Selector] Source #
Parses a CSS selector.