Copyright | (c) 2014 Alp Mestanogullari, Vikram Verma |
---|---|
License | BSD3 |
Maintainer | alpmestan@gmail.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Many useful combinators for querying Element
s
of a DOM tree.
- hasName :: Element -> Text -> Bool
- hasAttr :: Element -> AttrName -> Bool
- getAttr :: Element -> AttrName -> Maybe AttrValue
- innerText :: Element -> Text
- (//) :: Element -> (Element -> Bool) -> [Element]
- (/&) :: Element -> [Element -> Bool] -> [Element]
- (/*) :: Element -> [Element -> Bool] -> [Element]
- trees :: Element -> [Element]
- subtrees :: Element -> [Element]
Documentation
hasAttr :: Element -> AttrName -> Bool Source
Does the given element have an attribute with the given name (or key)
innerText :: Element -> Text Source
Get all the bits of raw text present
everywhere below the given Element
in the DOM tree.
(//) :: Element -> (Element -> Bool) -> [Element] Source
Filter an element and its children to those satisfying a given predicate.
(/&) :: Element -> [Element -> Bool] -> [Element] Source
Given a sequence of predicates, filter an element and its children, selecting only those subtrees who match the provided predicate for each point.
>>>
let element = (\(NodeElement e) -> e) . head . domify . taggyWith False $ "<html>foo<bar class=\"el\">baz</bar><qux class=\"el\"><quux></quux></qux></html>"
>>>
element /& [const False]
[]>>>
element /& [flip hasAttr "class", flip hasName "quux"]
[Element "quux" "" ""]