Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upRuntime Error: Cannot read property 'replaceData' #749
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
process-bot
Nov 10, 2016
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.
process-bot
commented
Nov 10, 2016
|
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. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
chancyk
Nov 11, 2016
{-| This code will reproduce issue https://github.com/elm-lang/core/issues/749
when the text from either div is cleared.
-}
import Html exposing (text)
import Html.App as App
import Html.Attributes exposing (contenteditable)
import Html.Events exposing (on)
import Json.Decode as Json
type Msg = HelloUpdate String | WorldUpdate String
update msg model =
case msg of
HelloUpdate txt ->
( { model | hello = txt }, Cmd.none )
WorldUpdate txt ->
( { model | world = txt }, Cmd.none )
initModel =
{ hello = "hello"
, world = "world"
}
view model =
Html.div
[]
[ Html.div
[ contenteditable True
, onInput HelloUpdate
]
[ text model.hello ]
, Html.div
[ contenteditable True
, onInput WorldUpdate
]
[ text model.world ]
]
onInput msg =
on "input" (Json.map msg innerHtmlDecoder)
innerHtmlDecoder =
Json.at ["target", "innerHTML"] Json.string
main =
App.program
{ init = (initModel, Cmd.none)
, update = update
, view = view
, subscriptions = (\_ -> Sub.none)
}
chancyk
commented
Nov 11, 2016
{-| This code will reproduce issue https://github.com/elm-lang/core/issues/749
when the text from either div is cleared.
-}
import Html exposing (text)
import Html.App as App
import Html.Attributes exposing (contenteditable)
import Html.Events exposing (on)
import Json.Decode as Json
type Msg = HelloUpdate String | WorldUpdate String
update msg model =
case msg of
HelloUpdate txt ->
( { model | hello = txt }, Cmd.none )
WorldUpdate txt ->
( { model | world = txt }, Cmd.none )
initModel =
{ hello = "hello"
, world = "world"
}
view model =
Html.div
[]
[ Html.div
[ contenteditable True
, onInput HelloUpdate
]
[ text model.hello ]
, Html.div
[ contenteditable True
, onInput WorldUpdate
]
[ text model.world ]
]
onInput msg =
on "input" (Json.map msg innerHtmlDecoder)
innerHtmlDecoder =
Json.at ["target", "innerHTML"] Json.string
main =
App.program
{ init = (initModel, Cmd.none)
, update = update
, view = view
, subscriptions = (\_ -> Sub.none)
} |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jvoigtlaender
Nov 11, 2016
Contributor
This probably belongs in https://github.com/elm-lang/html/issues or https://github.com/elm-lang/virtual-dom/issues, not here.
|
This probably belongs in https://github.com/elm-lang/html/issues or https://github.com/elm-lang/virtual-dom/issues, not here. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
chancyk
commented
Nov 11, 2016
|
I've moved the issue to https://github.com/elm-lang/virtual-dom/issues/48. |
chancyk commentedNov 10, 2016
•
edited
Edited 1 time
-
chancyk
edited Nov 11, 2016 (most recent)
Windows 7
Chrome 54.0.2840.71
EDIT: I've isolated what's causing the issue, which is clearing the text of a contenteditable div that has a
on "input"event attached to it. A reproducible example is included below as a separate comment.The error persists until the page is reloaded. A Chrome console screenshot follows:
which points to the following snippet from
applyPatch: