summaryrefslogtreecommitdiff
path: root/Miso
diff options
context:
space:
mode:
Diffstat (limited to 'Miso')
-rw-r--r--Miso/Extend.hs26
1 files changed, 26 insertions, 0 deletions
diff --git a/Miso/Extend.hs b/Miso/Extend.hs
new file mode 100644
index 0000000..e7a9ff6
--- /dev/null
+++ b/Miso/Extend.hs
@@ -0,0 +1,26 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+module Miso.Extend
+ ( crossorigin_,
+ onPreventClick,
+ )
+where
+
+import Miso
+import Miso.String
+
+-- | HTML crossorigin attribute
+--
+-- https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin
+crossorigin_ :: MisoString -> Attribute action
+crossorigin_ = textProp "crossorigin"
+
+-- | Like 'onClick' but prevents the default action from triggering. Use this to
+-- overide 'a_' links, for example.
+onPreventClick :: action -> Attribute action
+onPreventClick action =
+ onWithOptions
+ Miso.defaultOptions {preventDefault = True}
+ "click"
+ emptyDecoder
+ (\() -> action)