Doing JS events in LiveView

Using Chrome Developer tools on

http://palegoldenrod-grown-ibis.gigalixirapp.com/bear_game

it is actually using this code path

and scripts will execute with Range.createContextualFragment.

Try this in the console of a fresh tab:

let range = document.createRange()
let fragment = range.createContextualFragment(`<script>alert(1)</script>`)
document.documentElement.appendChild(fragment)

https://bugs.webkit.org/show_bug.cgi?id=12234

2 Likes