diff --git a/examples/todo-mvc/Main.hs b/examples/todo-mvc/Main.hs index b6b9cefb..c0258ecf 100644 --- a/examples/todo-mvc/Main.hs +++ b/examples/todo-mvc/Main.hs @@ -231,7 +231,7 @@ viewEntry Entry {..} = liKeyed_ (toKey eid) viewControls :: Model -> MisoString -> [ Entry ] -> View Msg viewControls model visibility entries = footer_ [ class_ "footer" - , hidden_ (bool "" "hidden" $ null entries) + , hidden_ (null entries) ] [ viewControlsCount entriesLeft , viewControlsFilters visibility diff --git a/examples/xhr/Main.hs b/examples/xhr/Main.hs index de053e35..909b257f 100644 --- a/examples/xhr/Main.hs +++ b/examples/xhr/Main.hs @@ -88,10 +88,7 @@ viewModel Model {..} = view where attrs = [ onClick FetchGitHub , class_ $ pack "button is-large is-outlined" - ] ++ - [ disabled_ $ pack "disabled" - | isJust info - ] + ] ++ [ disabled_ True | isJust info ] data APIInfo = APIInfo diff --git a/ghc-src/Miso/Html/Internal.hs b/ghc-src/Miso/Html/Internal.hs index 181e1178..32a2dc80 100644 --- a/ghc-src/Miso/Html/Internal.hs +++ b/ghc-src/Miso/Html/Internal.hs @@ -83,10 +83,24 @@ instance L.ToHtml (VTree action) where in L.with ele as where Props xs = vProps - as = [ L.makeAttribute k v' + as = [ L.makeAttribute k (if k `elem` exceptions && v == Bool True then k else v') | (k,v) <- M.toList xs , let v' = toHtmlFromJSON v + , not (k `elem` exceptions && v == Bool False) ] + exceptions = [ "checked" + , "disabled" + , "selected" + , "hidden" + , "readOnly" + , "autoplay" + , "required" + , "default" + , "autofocus" + , "multiple" + , "noValidate" + , "autocomplete" + ] toTag = T.toLower kids = foldMap L.toHtml vChildren diff --git a/src/Miso/Html/Property.hs b/src/Miso/Html/Property.hs index b79b14f1..c78588cd 100644 --- a/src/Miso/Html/Property.hs +++ b/src/Miso/Html/Property.hs @@ -151,8 +151,8 @@ title_ = textProp "title" selected_ :: Bool -> Attribute action selected_ = boolProp "selected" -- |