Last active
February 17, 2020 08:54
-
-
Save ilyagr/a035c3c7abb3389593ed7ccd51844568 to your computer and use it in GitHub Desktop.
// source https://jsbin.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html><body><script type="module"> | |
import { html, render } from "https://unpkg.com/[email protected]?module"; | |
function _selector(values) { | |
return html` | |
<select> | |
<option value="">Choose one:</option> | |
${values.map( | |
k => | |
html` | |
<option>${k}</option> | |
` | |
)} | |
</select> | |
`; | |
} | |
// 2 => 6 => 7 => 3 | |
class MyWidgetBug { | |
constructor() { | |
this.state = false; | |
} | |
refresh() { | |
render([html` | |
<input | |
type="checkbox" | |
@change=${e => { | |
this.state = e.target.checked; | |
this.refresh(); | |
}} | |
>`, | |
this.state ? _selector([1, 2, 3]) | |
: _selector([5, 6, 7]) | |
], | |
document.body | |
); | |
} | |
} | |
new MyWidgetBug().refresh(); | |
</script></body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment