css-selectors-0.2.0.0: Parsing, rendering and manipulating css selectors in Haskell.

Maintainerhapytexeu+gh@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Css.Selector.Core

Contents

Description

A module that defines the tree of types to represent and manipulate a css selector. These data types are members of several typeclasses to make these more useful.

Synopsis

ToCssSelector typeclass

class ToCssSelector a where Source #

A class that defines that the given type can be converted to a css selector value, and has a certain specificity.

Minimal complete definition

toCssSelector, toSelectorGroup, specificity', toPattern

Methods

toCssSelector Source #

Arguments

:: a

The given object for which we calculate the css selector.

-> Text

The css selector text for the given object.

Convert the given element to a Text object that contains the css selector.

toSelectorGroup Source #

Arguments

:: a

The item to lift to a SelectorGroup

-> SelectorGroup

The value of a SelectorGroup of which the object is the selective part.

Lift the given ToCssSelector type object to a SelectorGroup, which is the "root type" of the css selector hierarchy.

specificity' Source #

Arguments

:: a

The item for which we calculate the specificity level.

-> SelectorSpecificity

The specificity level of the given item. Convert the given ToCssSelector item to a Pat pattern, such that we can use it in functions.

Calculate the specificity of the css selector by returing a SelectorSpecificity object.

toPattern Source #

Arguments

:: a

The item to convert to a Pat.

-> Pat

The pattern that is generated that will match only items equal to the given object. Convert the given ToCssSelector item to an item in a more normalized form. A normalization is idempotent: applying this multiple times will have the same effect as applying it once.

normalize Source #

Arguments

:: a

The item to normalize.

-> a

A normalized variant of the given item. This will filter the same objects, and have the same specificity.

Instances
ToCssSelector Hash Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector Class Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector AttributeName Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector TypeSelector Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector ElementName Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector Namespace Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector Attrib Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector SelectorFilter Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector SelectorSequence Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector Selector Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

Selectors and combinators

data Selector Source #

The type of a single selector. This is a sequence of SelectorSequences that are combined with a SelectorCombinator.

Constructors

Selector SelectorSequence

Convert a given SelectorSequence to a Selector.

Combined SelectorSequence SelectorCombinator Selector

Create a combined selector where we have a SelectorSequence that is combined with a given SelectorCombinator to a Selector.

Instances
Eq Selector Source # 
Instance details

Defined in Css.Selector.Core

Data Selector Source # 
Instance details

Defined in Css.Selector.Core

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Selector -> c Selector #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Selector #

toConstr :: Selector -> Constr #

dataTypeOf :: Selector -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Selector) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Selector) #

gmapT :: (forall b. Data b => b -> b) -> Selector -> Selector #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Selector -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Selector -> r #

gmapQ :: (forall d. Data d => d -> u) -> Selector -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Selector -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Selector -> m Selector #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Selector -> m Selector #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Selector -> m Selector #

Ord Selector Source # 
Instance details

Defined in Css.Selector.Core

Show Selector Source # 
Instance details

Defined in Css.Selector.Core

Semigroup Selector Source # 
Instance details

Defined in Css.Selector.Core

Lift Selector Source # 
Instance details

Defined in Css.Selector.Core

Methods

lift :: Selector -> Q Exp #

Arbitrary Selector Source # 
Instance details

Defined in Css.Selector.Core

ToJSON Selector Source # 
Instance details

Defined in Css.Selector.Core

ToMarkup Selector Source # 
Instance details

Defined in Css.Selector.Core

Default Selector Source # 
Instance details

Defined in Css.Selector.Core

Methods

def :: Selector #

ToJavascript Selector Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector Selector Source # 
Instance details

Defined in Css.Selector.Core

data SelectorCombinator Source #

A type that contains the possible ways to combine SelectorSequences.

Constructors

Descendant

The second tag is a descendant of the first one, denoted in css with a space.

Child

The second tag is the (direct) child of the first one, denoted with a > in css.

DirectlyPreceded

The second tag is directly preceded by the first one, denoted with a + in css.

Preceded

The second tag is preceded by the first one, denoted with a ~ in css.

Instances
Bounded SelectorCombinator Source # 
Instance details

Defined in Css.Selector.Core

Enum SelectorCombinator Source # 
Instance details

Defined in Css.Selector.Core

Eq SelectorCombinator Source # 
Instance details

Defined in Css.Selector.Core

Data SelectorCombinator Source # 
Instance details

Defined in Css.Selector.Core

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SelectorCombinator -> c SelectorCombinator #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SelectorCombinator #

toConstr :: SelectorCombinator -> Constr #

dataTypeOf :: SelectorCombinator -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SelectorCombinator) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SelectorCombinator) #

gmapT :: (forall b. Data b => b -> b) -> SelectorCombinator -> SelectorCombinator #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SelectorCombinator -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SelectorCombinator -> r #

gmapQ :: (forall d. Data d => d -> u) -> SelectorCombinator -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SelectorCombinator -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SelectorCombinator -> m SelectorCombinator #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SelectorCombinator -> m SelectorCombinator #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SelectorCombinator -> m SelectorCombinator #

Ord SelectorCombinator Source # 
Instance details

Defined in Css.Selector.Core

Read SelectorCombinator Source # 
Instance details

Defined in Css.Selector.Core

Show SelectorCombinator Source # 
Instance details

Defined in Css.Selector.Core

Lift SelectorCombinator Source # 
Instance details

Defined in Css.Selector.Core

Arbitrary SelectorCombinator Source # 
Instance details

Defined in Css.Selector.Core

Default SelectorCombinator Source # 
Instance details

Defined in Css.Selector.Core

newtype SelectorGroup Source #

The root type of a css selector. This is a comma-separated list of selectors.

Constructors

SelectorGroup 

Fields

Instances
IsList SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

Associated Types

type Item SelectorGroup :: Type #

Eq SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

Data SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SelectorGroup -> c SelectorGroup #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SelectorGroup #

toConstr :: SelectorGroup -> Constr #

dataTypeOf :: SelectorGroup -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SelectorGroup) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SelectorGroup) #

gmapT :: (forall b. Data b => b -> b) -> SelectorGroup -> SelectorGroup #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SelectorGroup -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SelectorGroup -> r #

gmapQ :: (forall d. Data d => d -> u) -> SelectorGroup -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SelectorGroup -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SelectorGroup -> m SelectorGroup #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SelectorGroup -> m SelectorGroup #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SelectorGroup -> m SelectorGroup #

Ord SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

Show SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

Semigroup SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

Lift SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

Methods

lift :: SelectorGroup -> Q Exp #

Arbitrary SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

ToJSON SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

ToMarkup SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

Default SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

Methods

def :: SelectorGroup #

ToJavascript SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

type Item SelectorGroup Source # 
Instance details

Defined in Css.Selector.Core

data SelectorSequence Source #

A SelectorSequence is a TypeSelector (that can be Universal) followed by zero, one or more SelectorFilters these filter the selector further, for example with a Hash, a Class, or an Attrib.

Instances
Eq SelectorSequence Source # 
Instance details

Defined in Css.Selector.Core

Data SelectorSequence Source # 
Instance details

Defined in Css.Selector.Core

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SelectorSequence -> c SelectorSequence #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SelectorSequence #

toConstr :: SelectorSequence -> Constr #

dataTypeOf :: SelectorSequence -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SelectorSequence) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SelectorSequence) #

gmapT :: (forall b. Data b => b -> b) -> SelectorSequence -> SelectorSequence #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SelectorSequence -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SelectorSequence -> r #

gmapQ :: (forall d. Data d => d -> u) -> SelectorSequence -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SelectorSequence -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SelectorSequence -> m SelectorSequence #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SelectorSequence -> m SelectorSequence #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SelectorSequence -> m SelectorSequence #

Ord SelectorSequence Source # 
Instance details

Defined in Css.Selector.Core

Show SelectorSequence Source # 
Instance details

Defined in Css.Selector.Core

Lift SelectorSequence Source # 
Instance details

Defined in Css.Selector.Core

Methods

lift :: SelectorSequence -> Q Exp #

Arbitrary SelectorSequence Source # 
Instance details

Defined in Css.Selector.Core

ToJSON SelectorSequence Source # 
Instance details

Defined in Css.Selector.Core

ToMarkup SelectorSequence Source # 
Instance details

Defined in Css.Selector.Core

Default SelectorSequence Source # 
Instance details

Defined in Css.Selector.Core

ToJavascript SelectorSequence Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector SelectorSequence Source # 
Instance details

Defined in Css.Selector.Core

combinatorText Source #

Arguments

:: SelectorCombinator

The given SelectorCombinator to retrieve the css token for.

-> Text

The css selector token that is used for the given SelectorCombinator.

Convert the SelectorCombinator to the equivalent css selector text. A space for Descendant, a > for Child, a + for DirectlyPreceded, and a ~ for Preceded

combine Source #

Arguments

:: SelectorCombinator

The SelectorCombinator that is applied between the two Selectors.

-> Selector

The left Selector.

-> Selector

The right Selector.

-> Selector

A Selector that is a combination of the left Selector and the right Selector with the given SelectorCombinator.

Combines two Selectors with the given SelectorCombinator.

(.>) Source #

Arguments

:: Selector

The left Selector.

-> Selector

The right Selector.

-> Selector

A selector that is the combination of the left Selector and the right Selector through Child.

Combines two Selectors with the Child combinator.

(.+) Source #

Arguments

:: Selector

The left Selector.

-> Selector

The right Selector.

-> Selector

A selector that is the combination of the left Selector and the right Selector through DirectlyPreceded.

Combines two Selectors with the DirectlyPreceded combinator.

(.~) Source #

Arguments

:: Selector

The left Selector.

-> Selector

The right Selector.

-> Selector

A selector that is the combination of the left Selector and the right Selector through Preceded.

Combines two Selectors with the Preceded combinator.

Filters

data SelectorFilter Source #

A type that sums up the different ways to filter a type selector: with an id (hash), a class, and an attribute.

Constructors

SHash Hash

A Hash object as filter.

SClass Class

A Class object as filter.

SAttrib Attrib

An Attrib object as filter.

Instances
Eq SelectorFilter Source # 
Instance details

Defined in Css.Selector.Core

Data SelectorFilter Source # 
Instance details

Defined in Css.Selector.Core

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SelectorFilter -> c SelectorFilter #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SelectorFilter #

toConstr :: SelectorFilter -> Constr #

dataTypeOf :: SelectorFilter -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SelectorFilter) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SelectorFilter) #

gmapT :: (forall b. Data b => b -> b) -> SelectorFilter -> SelectorFilter #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SelectorFilter -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SelectorFilter -> r #

gmapQ :: (forall d. Data d => d -> u) -> SelectorFilter -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SelectorFilter -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SelectorFilter -> m SelectorFilter #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SelectorFilter -> m SelectorFilter #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SelectorFilter -> m SelectorFilter #

Ord SelectorFilter Source # 
Instance details

Defined in Css.Selector.Core

Show SelectorFilter Source # 
Instance details

Defined in Css.Selector.Core

Lift SelectorFilter Source # 
Instance details

Defined in Css.Selector.Core

Methods

lift :: SelectorFilter -> Q Exp #

Arbitrary SelectorFilter Source # 
Instance details

Defined in Css.Selector.Core

ToJSON SelectorFilter Source # 
Instance details

Defined in Css.Selector.Core

ToMarkup SelectorFilter Source # 
Instance details

Defined in Css.Selector.Core

ToJavascript SelectorFilter Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector SelectorFilter Source # 
Instance details

Defined in Css.Selector.Core

filters Source #

Arguments

:: SelectorSequence

The given SelectorSequence to analyze.

-> [SelectorFilter]

The given list of SelectorFilters applied, this can be empty.

Obtain the list of filters that are applied in the given SelectorSequence.

filters' Source #

Arguments

:: SelectorSequence

The given SelectorSequence to analyze.

-> [SelectorFilter]

The given list of SelectorFilters applied in reversed order, this can be empty.

Obtain the list of filters that are applied in the given SelectorSequence in reversed order.

addFilters Source #

Arguments

:: SelectorSequence

The SelectorSequence to apply the filter on.

-> [SelectorFilter]

The list of SelectorFilters to apply on the SelectorSequence.

-> SelectorSequence

A modified SelectorSequence where we applied the list of SelectorFilters.

Add a given list of SelectorFilters to the given SelectorSequence. The filters are applied left-to-right.

(.:) Source #

Arguments

:: SelectorSequence

The SelectorSequence to apply the filter on.

-> [SelectorFilter]

The list of SelectorFilters to apply on the SelectorSequence.

-> SelectorSequence

A modified SelectorSequence where we applied the list of SelectorFilters.

An infix variant of the addFilters function.

Namespaces

data Namespace Source #

The namespace of a css selector tag. The namespace can be NAny (all possible namespaces), or a namespace with a given text (this text can be empty).

Constructors

NAny

A typeselector part that specifies that we accept all namespaces, in css denoted with *.

Namespace Text

A typselector part that specifies that we accept a certain namespace name.

Instances
Eq Namespace Source # 
Instance details

Defined in Css.Selector.Core

Data Namespace Source # 
Instance details

Defined in Css.Selector.Core

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Namespace -> c Namespace #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Namespace #

toConstr :: Namespace -> Constr #

dataTypeOf :: Namespace -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Namespace) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Namespace) #

gmapT :: (forall b. Data b => b -> b) -> Namespace -> Namespace #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Namespace -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Namespace -> r #

gmapQ :: (forall d. Data d => d -> u) -> Namespace -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Namespace -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Namespace -> m Namespace #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Namespace -> m Namespace #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Namespace -> m Namespace #

Ord Namespace Source # 
Instance details

Defined in Css.Selector.Core

Show Namespace Source # 
Instance details

Defined in Css.Selector.Core

IsString Namespace Source # 
Instance details

Defined in Css.Selector.Core

Semigroup Namespace Source # 
Instance details

Defined in Css.Selector.Core

Monoid Namespace Source # 
Instance details

Defined in Css.Selector.Core

Arbitrary Namespace Source # 
Instance details

Defined in Css.Selector.Core

Default Namespace Source # 
Instance details

Defined in Css.Selector.Core

Methods

def :: Namespace #

ToCssSelector Namespace Source # 
Instance details

Defined in Css.Selector.Core

pattern NEmpty :: Namespace Source #

The empty namespace. This is not the wildcard namespace (*). This is a bidirectional namespace and can thus be used in expressions as well.

Type selectors

data ElementName Source #

The element name of a css selector tag. The element name can be EAny (all possible tag names), or an element name with a given text.

Constructors

EAny

A typeselector part that specifies that we accept all element names, in css denoted with *.

ElementName Text

A typeselector part that specifies that we accept a certain element name.

Instances
Eq ElementName Source # 
Instance details

Defined in Css.Selector.Core

Data ElementName Source # 
Instance details

Defined in Css.Selector.Core

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ElementName -> c ElementName #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ElementName #

toConstr :: ElementName -> Constr #

dataTypeOf :: ElementName -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ElementName) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ElementName) #

gmapT :: (forall b. Data b => b -> b) -> ElementName -> ElementName #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ElementName -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ElementName -> r #

gmapQ :: (forall d. Data d => d -> u) -> ElementName -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ElementName -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ElementName -> m ElementName #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ElementName -> m ElementName #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ElementName -> m ElementName #

Ord ElementName Source # 
Instance details

Defined in Css.Selector.Core

Show ElementName Source # 
Instance details

Defined in Css.Selector.Core

IsString ElementName Source # 
Instance details

Defined in Css.Selector.Core

Semigroup ElementName Source # 
Instance details

Defined in Css.Selector.Core

Monoid ElementName Source # 
Instance details

Defined in Css.Selector.Core

Arbitrary ElementName Source # 
Instance details

Defined in Css.Selector.Core

Default ElementName Source # 
Instance details

Defined in Css.Selector.Core

Methods

def :: ElementName #

ToCssSelector ElementName Source # 
Instance details

Defined in Css.Selector.Core

data TypeSelector Source #

A typeselector is a combination of a selector for a namespace, and a selector for an element name. One, or both can be a wildcard.

Constructors

TypeSelector 

Fields

Instances
Eq TypeSelector Source # 
Instance details

Defined in Css.Selector.Core

Data TypeSelector Source # 
Instance details

Defined in Css.Selector.Core

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TypeSelector -> c TypeSelector #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TypeSelector #

toConstr :: TypeSelector -> Constr #

dataTypeOf :: TypeSelector -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TypeSelector) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeSelector) #

gmapT :: (forall b. Data b => b -> b) -> TypeSelector -> TypeSelector #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TypeSelector -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TypeSelector -> r #

gmapQ :: (forall d. Data d => d -> u) -> TypeSelector -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TypeSelector -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TypeSelector -> m TypeSelector #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeSelector -> m TypeSelector #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeSelector -> m TypeSelector #

Ord TypeSelector Source # 
Instance details

Defined in Css.Selector.Core

Show TypeSelector Source # 
Instance details

Defined in Css.Selector.Core

Arbitrary TypeSelector Source # 
Instance details

Defined in Css.Selector.Core

Default TypeSelector Source # 
Instance details

Defined in Css.Selector.Core

Methods

def :: TypeSelector #

ToCssSelector TypeSelector Source # 
Instance details

Defined in Css.Selector.Core

pattern Universal :: TypeSelector Source #

The universal type selector: a selector that matches all types in all namespaces (including the empty namespace). This pattern is bidirectional and thus can be used in expressions as well.

(.|) Source #

Arguments

:: Namespace

The Namespace for the TypeSelector.

-> ElementName

The ElementName for the TypeSelector.

-> TypeSelector

A TypeSelector object constructed with the Namespace and ElementName.

Construct a TypeSelector with a given Namespace and ElementName.

Attributes

data Attrib Source #

A css attribute can come in two flavors: either a constraint that the attribute should exists, or a constraint that a certain attribute should have a certain value (prefix, suffix, etc.).

Constructors

Exist AttributeName

A constraint that the given AttributeName should exist.

Attrib AttributeName AttributeCombinator AttributeValue

A constraint about the value associated with the given AttributeName.

Instances
Eq Attrib Source # 
Instance details

Defined in Css.Selector.Core

Methods

(==) :: Attrib -> Attrib -> Bool #

(/=) :: Attrib -> Attrib -> Bool #

Data Attrib Source # 
Instance details

Defined in Css.Selector.Core

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Attrib -> c Attrib #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Attrib #

toConstr :: Attrib -> Constr #

dataTypeOf :: Attrib -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Attrib) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attrib) #

gmapT :: (forall b. Data b => b -> b) -> Attrib -> Attrib #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attrib -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attrib -> r #

gmapQ :: (forall d. Data d => d -> u) -> Attrib -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Attrib -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Attrib -> m Attrib #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Attrib -> m Attrib #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Attrib -> m Attrib #

Ord Attrib Source # 
Instance details

Defined in Css.Selector.Core

Show Attrib Source # 
Instance details

Defined in Css.Selector.Core

IsString Attrib Source # 
Instance details

Defined in Css.Selector.Core

Methods

fromString :: String -> Attrib #

Lift Attrib Source # 
Instance details

Defined in Css.Selector.Core

Methods

lift :: Attrib -> Q Exp #

Arbitrary Attrib Source # 
Instance details

Defined in Css.Selector.Core

ToJSON Attrib Source # 
Instance details

Defined in Css.Selector.Core

ToMarkup Attrib Source # 
Instance details

Defined in Css.Selector.Core

ToJavascript Attrib Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector Attrib Source # 
Instance details

Defined in Css.Selector.Core

data AttributeCombinator Source #

The possible ways to match an attribute with a given value in a css selector.

Constructors

Exact

The attribute has exactly the value of the value, denoted with = in css.

Include

The attribute has a whitespace separated list of items, one of these items is the value, denoted with ~= in css.

DashMatch

The attribute has a hyphen separated list of items, the first item is the value, denoted with |= in css.

PrefixMatch

The value is a prefix of the value in the attribute, denoted with ^= in css.

SuffixMatch

The value is a suffix of the value in the attribute, denoted with $= in css.

SubstringMatch

The value is a substring of the value in the attribute, denoted with *= in css.

Instances
Bounded AttributeCombinator Source # 
Instance details

Defined in Css.Selector.Core

Enum AttributeCombinator Source # 
Instance details

Defined in Css.Selector.Core

Eq AttributeCombinator Source # 
Instance details

Defined in Css.Selector.Core

Data AttributeCombinator Source # 
Instance details

Defined in Css.Selector.Core

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AttributeCombinator -> c AttributeCombinator #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c AttributeCombinator #

toConstr :: AttributeCombinator -> Constr #

dataTypeOf :: AttributeCombinator -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c AttributeCombinator) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AttributeCombinator) #

gmapT :: (forall b. Data b => b -> b) -> AttributeCombinator -> AttributeCombinator #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AttributeCombinator -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AttributeCombinator -> r #

gmapQ :: (forall d. Data d => d -> u) -> AttributeCombinator -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> AttributeCombinator -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> AttributeCombinator -> m AttributeCombinator #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AttributeCombinator -> m AttributeCombinator #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AttributeCombinator -> m AttributeCombinator #

Ord AttributeCombinator Source # 
Instance details

Defined in Css.Selector.Core

Read AttributeCombinator Source # 
Instance details

Defined in Css.Selector.Core

Show AttributeCombinator Source # 
Instance details

Defined in Css.Selector.Core

Arbitrary AttributeCombinator Source # 
Instance details

Defined in Css.Selector.Core

Default AttributeCombinator Source # 
Instance details

Defined in Css.Selector.Core

data AttributeName Source #

An attribute name is a name that optionally has a namespace, and the name of the attribute.

Constructors

AttributeName 

Fields

Instances
Eq AttributeName Source # 
Instance details

Defined in Css.Selector.Core

Data AttributeName Source # 
Instance details

Defined in Css.Selector.Core

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AttributeName -> c AttributeName #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c AttributeName #

toConstr :: AttributeName -> Constr #

dataTypeOf :: AttributeName -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c AttributeName) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AttributeName) #

gmapT :: (forall b. Data b => b -> b) -> AttributeName -> AttributeName #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AttributeName -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AttributeName -> r #

gmapQ :: (forall d. Data d => d -> u) -> AttributeName -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> AttributeName -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> AttributeName -> m AttributeName #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AttributeName -> m AttributeName #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AttributeName -> m AttributeName #

Ord AttributeName Source # 
Instance details

Defined in Css.Selector.Core

Show AttributeName Source # 
Instance details

Defined in Css.Selector.Core

IsString AttributeName Source # 
Instance details

Defined in Css.Selector.Core

Arbitrary AttributeName Source # 
Instance details

Defined in Css.Selector.Core

ToCssSelector AttributeName Source # 
Instance details

Defined in Css.Selector.Core

type AttributeValue = Text Source #

We use Text as the type to store an attribute value.

(.=) Source #

Arguments

:: AttributeName

The name of the attribute to constraint.

-> AttributeValue

The value that constraints the attribute.

-> Attrib

The Attrib object we construct with the given name and value.

Create an Attrib where the given AttributeName is constrainted to be exactly the given value.

(.~=) Source #

Arguments

:: AttributeName

The name of the attribute to constraint.

-> AttributeValue

The value that constraints the attribute.

-> Attrib

The Attrib object we construct with the given name and value.

Create an Attrib where the given AttributeName is constrainted such that the attribute is a whitespace seperated list of items, and the value is one of these items.

(.|=) Source #

Arguments

:: AttributeName

The name of the attribute to constraint.

-> AttributeValue

The value that constraints the attribute.

-> Attrib

The Attrib object we construct with the given name and value.

Create an Attrib where the given AttributeName is constrainted such that the attribute is a dash seperated list of items, and the value is the first of these items.

(.^=) Source #

Arguments

:: AttributeName

The name of the attribute to constraint.

-> AttributeValue

The value that constraints the attribute.

-> Attrib

The Attrib object we construct with the given name and value.

Create an Attrib where the given AttributeName is constrainted such that the attribute has as prefix the given AttributeValue.

(.$=) Source #

Arguments

:: AttributeName

The name of the attribute to constraint.

-> AttributeValue

The value that constraints the attribute.

-> Attrib

The Attrib object we construct with the given name and value.

Create an Attrib where the given AttributeName is constrainted such that the attribute has as suffix the given AttributeValue.

(.*=) Source #

Arguments

:: AttributeName

The name of the attribute to constraint.

-> AttributeValue

The value that constraints the attribute.

-> Attrib

The Attrib object we construct with the given name and value.

Create an Attrib where the given AttributeName is constrainted such that the attribute has as substring the given AttributeValue.

attrib Source #

Arguments

:: AttributeCombinator

The AttributeCombinator that specifies the required relation between the attribute and a value.

-> AttributeName

The name of an attribute to filter.

-> AttributeValue

The value of the attribute to filter.

-> Attrib

The result is an Attrib object that will filter the given AttributeName with the given AttributeCombinator.

A flipped version of the Attrib data constructor, where one first specifies the conbinator, then the AttributeName and finally the value.

attributeCombinatorText Source #

Arguments

:: AttributeCombinator

The AttributeCombinator for which we obtain the corresponding css selector text.

-> AttributeValue

The css selector text for the given AttributeCombinator.

Convert the given AttributeCombinator to its css selector counterpart.

Classes

newtype Class Source #

A css class, this is wrapped in a data type. The type only wraps the class name, not the dot prefix.

Constructors

Class 

Fields

Instances
Eq Class Source # 
Instance details

Defined in Css.Selector.Core

Methods

(==) :: Class -> Class -> Bool #

(/=) :: Class -> Class -> Bool #

Data Class Source # 
Instance details

Defined in Css.Selector.Core

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Class -> c Class #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Class #

toConstr :: Class -> Constr #

dataTypeOf :: Class -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Class) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Class) #

gmapT :: (forall b. Data b => b -> b) -> Class -> Class #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Class -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Class -> r #

gmapQ :: (forall d. Data d => d -> u) -> Class -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Class -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Class -> m Class #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Class -> m Class #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Class -> m Class #

Ord Class Source # 
Instance details

Defined in Css.Selector.Core

Methods

compare :: Class -> Class -> Ordering #

(<) :: Class -> Class -> Bool #

(<=) :: Class -> Class -> Bool #

(>) :: Class -> Class -> Bool #

(>=) :: Class -> Class -> Bool #

max :: Class -> Class -> Class #

min :: Class -> Class -> Class #

Show Class Source # 
Instance details

Defined in Css.Selector.Core

Methods

showsPrec :: Int -> Class -> ShowS #

show :: Class -> String #

showList :: [Class] -> ShowS #

IsString Class Source # 
Instance details

Defined in Css.Selector.Core

Methods

fromString :: String -> Class #

Arbitrary Class Source # 
Instance details

Defined in Css.Selector.Core

Methods

arbitrary :: Gen Class #

shrink :: Class -> [Class] #

ToCssSelector Class Source # 
Instance details

Defined in Css.Selector.Core

(...) Source #

Arguments

:: SelectorSequence

The given 'SelectorSequence to filter.

-> Class

The given Class to filter the SelectorSequence further.

-> SelectorSequence

A SelectorSequence that is filtered additionally with the given Class.

Filter a given SelectorSequence with a given Class.

Hashes

newtype Hash Source #

A css hash (used to match an element with a given id). The type only wraps the hash name, not the hash (#) prefix.

Constructors

Hash 

Fields

Instances
Eq Hash Source # 
Instance details

Defined in Css.Selector.Core

Methods

(==) :: Hash -> Hash -> Bool #

(/=) :: Hash -> Hash -> Bool #

Data Hash Source # 
Instance details

Defined in Css.Selector.Core

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Hash -> c Hash #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Hash #

toConstr :: Hash -> Constr #

dataTypeOf :: Hash -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Hash) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Hash) #

gmapT :: (forall b. Data b => b -> b) -> Hash -> Hash #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Hash -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Hash -> r #

gmapQ :: (forall d. Data d => d -> u) -> Hash -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Hash -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Hash -> m Hash #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Hash -> m Hash #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Hash -> m Hash #

Ord Hash Source # 
Instance details

Defined in Css.Selector.Core

Methods

compare :: Hash -> Hash -> Ordering #

(<) :: Hash -> Hash -> Bool #

(<=) :: Hash -> Hash -> Bool #

(>) :: Hash -> Hash -> Bool #

(>=) :: Hash -> Hash -> Bool #

max :: Hash -> Hash -> Hash #

min :: Hash -> Hash -> Hash #

Show Hash Source # 
Instance details

Defined in Css.Selector.Core

Methods

showsPrec :: Int -> Hash -> ShowS #

show :: Hash -> String #

showList :: [Hash] -> ShowS #

IsString Hash Source # 
Instance details

Defined in Css.Selector.Core

Methods

fromString :: String -> Hash #

Arbitrary Hash Source # 
Instance details

Defined in Css.Selector.Core

Methods

arbitrary :: Gen Hash #

shrink :: Hash -> [Hash] #

ToCssSelector Hash Source # 
Instance details

Defined in Css.Selector.Core

(.#) Source #

Arguments

:: SelectorSequence

The given SelectorSequence to filter.

-> Hash

The given Hash to filter the SelectorSequence further.

-> SelectorSequence

A SelectorSequence that is filtered additionally with the given Hash.

Filter a given SelectorSequence with a given Hash.

Specificity

data SelectorSpecificity Source #

A datastructure that specifies the selectivity of a css selector. The specificity is calculated based on three integers: a, b and c.

The specificity is calculated with 100*a+10*b+c where a, b and c count certain elements of the css selector.

Constructors

SelectorSpecificity Int Int Int

Create a SelectorSpecificity object with a given value for a, b, and c.

Instances
Eq SelectorSpecificity Source # 
Instance details

Defined in Css.Selector.Core

Data SelectorSpecificity Source # 
Instance details

Defined in Css.Selector.Core

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SelectorSpecificity -> c SelectorSpecificity #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SelectorSpecificity #

toConstr :: SelectorSpecificity -> Constr #

dataTypeOf :: SelectorSpecificity -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SelectorSpecificity) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SelectorSpecificity) #

gmapT :: (forall b. Data b => b -> b) -> SelectorSpecificity -> SelectorSpecificity #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SelectorSpecificity -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SelectorSpecificity -> r #

gmapQ :: (forall d. Data d => d -> u) -> SelectorSpecificity -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SelectorSpecificity -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SelectorSpecificity -> m SelectorSpecificity #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SelectorSpecificity -> m SelectorSpecificity #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SelectorSpecificity -> m SelectorSpecificity #

Ord SelectorSpecificity Source # 
Instance details

Defined in Css.Selector.Core

Show SelectorSpecificity Source # 
Instance details

Defined in Css.Selector.Core

Semigroup SelectorSpecificity Source # 
Instance details

Defined in Css.Selector.Core

Monoid SelectorSpecificity Source # 
Instance details

Defined in Css.Selector.Core

Default SelectorSpecificity Source # 
Instance details

Defined in Css.Selector.Core

specificity Source #

Arguments

:: ToCssSelector a 
=> a

The object for which we evaluate the specificity.

-> Int

The specificity level as an Int value.

Calculate the specificity of a ToCssSelector type object. This is done by calculating the SelectorSpecificity object, and then calculating the value of that object.

specificityValue Source #

Arguments

:: SelectorSpecificity

The SelectorSpecificity to calculate the specificity value from.

-> Int

The specificity level of the SelectorSpecificity. If the value is higher, the rules in the css selector take precedence.

Calculate the specificity value of the SelectorSpecificity