Skip to content

Instantly share code, notes, and snippets.

@insin
Last active August 29, 2015 14:14
Show Gist options
  • Save insin/4ce0df7537a567f1eecb to your computer and use it in GitHub Desktop.
Save insin/4ce0df7537a567f1eecb to your computer and use it in GitHub Desktop.
Riot.js Boolean Attribute Test Case - http://bl.ocks.org/insin/raw/4ce0df7537a567f1eecb/
<boolean-attrs>
<p><code>riot.version: {opts.version}</code></p>
<p>Try using the toggle button before and after clicking on the checkboxes. Not working in v2.0.5.</p>
<p><code>bool: {String(this.bool)}</code></p>
<label><input type="checkbox" checked={this.bool}> <code>checked=\{this.bool\}</code></label>
<br>
<label><input type="checkbox" checked={!this.bool}> <code>checked=\{!this.bool\}</code></label>
<br>
<button type="button" onclick={toggleBool}>Toggle <code>bool</code></button>
this.bool = false
toggleBool() {
this.bool = !this.bool
}
</boolean-attrs>
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>Riot.js Boolean Attribute Test Case</title>
</head>
<body>
<boolean-attrs></boolean-attrs>
<script src="boolean-attrs.tag" type="riot/tag"></script>
<script src="https://raw.githubusercontent.com/muut/riotjs/master/riot.js"></script>
<script src="https://raw.githubusercontent.com/muut/riotjs/master/compiler.js"></script>
<script>
riot.mount('boolean-attrs', {version: riot.version})
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment