diff options
author | Markus Wüstenberg | 2021-06-09 10:56:22 +0200 |
---|---|---|
committer | GitHub | 2021-06-09 10:56:22 +0200 |
commit | 0efc71d6f326efc88d25688f50f83b948b40fc38 (patch) | |
tree | d823518781f021db1fccbd051493a242fdeec352 /gomponents_test.go | |
parent | ba0d83f4fb1b588f7931b9a31609807adfa11163 (diff) | |
download | gomponents-0efc71d6f326efc88d25688f50f83b948b40fc38.tar.lz gomponents-0efc71d6f326efc88d25688f50f83b948b40fc38.tar.zst gomponents-0efc71d6f326efc88d25688f50f83b948b40fc38.zip |
Add javascript alert onclick handler to Raw example (#82)
Makes for fun XSS testing.
Diffstat (limited to 'gomponents_test.go')
-rw-r--r-- | gomponents_test.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gomponents_test.go b/gomponents_test.go index 3064c0f..db2dfee 100644 --- a/gomponents_test.go +++ b/gomponents_test.go @@ -205,9 +205,11 @@ func TestRaw(t *testing.T) { } func ExampleRaw() { - e := g.El("span", g.Raw("<strong>Party</strong> hats > normal hats.")) + e := g.El("span", + g.Raw(`<button onclick="javascript:alert('Party time!')">Party hats</button> > normal hats.`), + ) _ = e.Render(os.Stdout) - // Output: <span><strong>Party</strong> hats > normal hats.</span> + // Output: <span><button onclick="javascript:alert('Party time!')">Party hats</button> > normal hats.</span> } func TestGroup(t *testing.T) { |