We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
module Main exposing (main) import Browser import Html exposing (Html) import Html.Attributes import Html.Events import Task import Json.Encode main = Browser.element { init = init , update = update , view = view , subscriptions = always Sub.none } init : () -> ( Bool, Cmd () ) init () = ( False , Cmd.none ) update : () -> Bool -> ( Bool, Cmd msg ) update () _ = ( True, Cmd.none ) view : Bool -> Html () view loaded = case loaded of True -> Html.div [] [ Html.text "It works ok!" ] False -> Html.div [ (if True then (Html.Attributes.property "contentEditable" (Json.Encode.bool True)) else (Html.Attributes.attribute "contentEditable" "true") ) , Html.Events.onClick () ] [ Html.text "CLICK ME" ]
CLICK ME
True
False
Discourse: https://discourse.elm-lang.org/t/why-do-i-get-a-runtime-error/3243/2
The text was updated successfully, but these errors were encountered:
Elm Virtual Dom diffing algorithm tries to remove the contentEditable property by doing:
contentEditable
node.contentEditable = null;
which is not supported for contentEditable.
You can produce the same error by doing in a javascript console:
document.body.contentEditable = null
This is a known bug traced here: bug #104 (specifically #81)
I guess that the work-arounds are:
attribute "contenteditable"
Encode.bool False
Html.Keyed
div
Sorry, something went wrong.
contenteditable
No branches or pull requests
SSCCE: https://ellie-app.com/4TNwCtWm5HGa1
Notes
CLICK ME
to get the runtime error.True
toFalse
on line 38 (i.e. setting an attribute rather than a property) fixes this.True
toFalse
on line 39 (i.e. the value of the contentEditable property) does *not fix this.Discourse: https://discourse.elm-lang.org/t/why-do-i-get-a-runtime-error/3243/2
The text was updated successfully, but these errors were encountered: