|
@@ -78,6 +78,7 @@ queryAll' constructor selector doc = do
|
|
|
data DetachedNode =
|
|
data DetachedNode =
|
|
|
DetachedElement {tag :: String, content :: String, id :: Maybe String, classes :: List String}
|
|
DetachedElement {tag :: String, content :: String, id :: Maybe String, classes :: List String}
|
|
|
| DetachedA {content :: String, href :: String}
|
|
| DetachedA {content :: String, href :: String}
|
|
|
|
|
+ | DetachedButton {content :: String, role :: Maybe String, classes :: List String}
|
|
|
| DetachedComment String
|
|
| DetachedComment String
|
|
|
| DetachedText String
|
|
| DetachedText String
|
|
|
|
|
|
|
@@ -128,6 +129,16 @@ toDetached node = unsafePartial $ toDetached' (nodeType node) node where
|
|
|
href: unsafePartial $ fromJust href
|
|
href: unsafePartial $ fromJust href
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ elementToDetached el "BUTTON" text = do
|
|
|
|
|
+ role <- getAttribute "role" el
|
|
|
|
|
+ classes <- getClassList el
|
|
|
|
|
+
|
|
|
|
|
+ pure $ DetachedButton {
|
|
|
|
|
+ content: normalize text,
|
|
|
|
|
+ role,
|
|
|
|
|
+ classes
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
elementToDetached el tag text = do
|
|
elementToDetached el tag text = do
|
|
|
id <- E.id el
|
|
id <- E.id el
|
|
|
-- On SVG elements "className" returns a weird "SVGString" type that cannot be trimmed
|
|
-- On SVG elements "className" returns a weird "SVGString" type that cannot be trimmed
|