Safe Haskell | None |
---|---|
Language | Haskell2010 |
Stylist.Parse.Selector
Description
Parses CSS selectors
See parseSelectors
Synopsis
- data Selector
- data SimpleSelector
- = Tag Text
- | Namespace Text
- | Id Text
- | Class Text
- | Property (Maybe Text) Text PropertyTest
- | Psuedoclass Text [Token]
- data PropertyTest
- data PropertyFunc = PropertyFunc (String -> Bool)
- parseSelectors :: Parser [Selector]
Documentation
A CSS "selector" indicating which elements should be effected by CSS.
Constructors
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.
Constructors
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 Stylist.Parse.Selector Methods (==) :: SimpleSelector -> SimpleSelector -> Bool (/=) :: SimpleSelector -> SimpleSelector -> Bool | |
Show SimpleSelector Source # | |
Defined in Stylist.Parse.Selector Methods showsPrec :: Int -> SimpleSelector -> ShowS show :: SimpleSelector -> String showList :: [SimpleSelector] -> ShowS |
data PropertyTest Source #
How should a property be matched.
Constructors
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 Stylist.Parse.Selector | |
Show PropertyTest Source # | |
Defined in Stylist.Parse.Selector Methods showsPrec :: Int -> PropertyTest -> ShowS show :: PropertyTest -> String showList :: [PropertyTest] -> ShowS |
data PropertyFunc Source #
Caller-specified functions to extend property selection. Has incorrect Show/Eq implementations so this rare exception doesn't break things.
Constructors
PropertyFunc (String -> Bool) |
Instances
Eq PropertyFunc Source # | |
Defined in Stylist.Parse.Selector | |
Show PropertyFunc Source # | |
Defined in Stylist.Parse.Selector Methods showsPrec :: Int -> PropertyFunc -> ShowS show :: PropertyFunc -> String showList :: [PropertyFunc] -> ShowS |
parseSelectors :: Parser [Selector] Source #
Parses a CSS selector.