elm / virtual-dom

The foundation of HTML and SVG in Elm.
https://package.elm-lang.org/packages/elm/virtual-dom/latest
BSD 3-Clause "New" or "Revised" License
209 stars 80 forks source link

Prepending node without `contentEditable` to node with `contenteditable True` throws runtime exception. #88

Closed Damirados closed 7 years ago

Damirados commented 7 years ago

Firefox 52 and chromium 57, elm 0.18, linux

Here is example code, Prepend non editable will throw exception:

import Html exposing (beginnerProgram, div, button, text, span)
import Html.Attributes exposing (contenteditable)
import Html.Events exposing (onClick)

main =
  beginnerProgram { model = [Editable], view = view, update = (::) }

type Element = NonEditable | Editable

view model =
  div []
    [ button [ onClick NonEditable ] [ text "Prepend non editable" ]
    , button [ onClick Editable ] [ text "Prepend editable" ]
    , div [] (List.map viewElement model)
    ]

viewElement element =
  case element of
    NonEditable ->
      span [] [ text "non editable" ]

    Editable ->
      span [ contenteditable True ] [ text "editable" ]

works with this code

viewElement element =
  case element of
    NonEditable ->
      span [ contenteditable False ] [ text "non editable" ]

    Editable ->
      span [ contenteditable True ] [ text "editable" ]
process-bot commented 7 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

evancz commented 7 years ago

I am consolidating all contenteditable stuff into #104, so we can see it all in one place.

Thanks for the report!