1
1
mirror of https://github.com/aelve/guide.git synced 2024-11-23 04:07:14 +03:00

Use # instead of javascript:void(0) for buttons

It's faster in Firefox
This commit is contained in:
Artyom 2016-03-08 16:51:30 +03:00
parent 626c01b703
commit 03311f0abd
2 changed files with 7 additions and 5 deletions

View File

@ -1317,15 +1317,16 @@ textButton
-> HtmlT IO ()
textButton caption (JS handler) =
span_ [class_ "text-button"] $
a_ [href_ "javascript:void(0)", onclick_ handler] (toHtml caption)
-- TODO: use # instead of javascript:void(0), the latter is slow in Firefox
-- for me
-- “#” is used instead of javascript:void(0) because the latter is slow
-- in Firefox (at least for me tested with Firefox 43 on Arch Linux)
a_ [href_ "#", onclick_ (handler <> "return false;")]
(toHtml caption)
-- So far all icons used here have been from <https://useiconic.com/open/>
imgButton :: Url -> [Attribute] -> JS -> HtmlT IO ()
imgButton src attrs (JS handler) =
a_ [href_ "javascript:void(0)", onclick_ handler] (img_ (src_ src : attrs))
a_ [href_ "#", onclick_ (handler <> "return false;")]
(img_ (src_ src : attrs))
uid_ :: Uid -> Attribute
uid_ = id_ . uidToText

View File

@ -66,6 +66,7 @@ a:link {color: #008ACE; text-decoration: none;}
a:visited {color: #B40EB4; text-decoration: none;}
a:hover {text-decoration: underline;}
a:active {text-decoration: underline;}
.text-button > a:visited {color: #008ACE;}
a.anchor {
margin-right: 0.5em;