Last active
December 15, 2015 12:09
-
-
Save sjmiles/5258516 to your computer and use it in GitHub Desktop.
Exploring expectations around template.createInstance
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
<!DOCTYPE html> | |
<!-- | |
Copyright 2013 The Toolkitchen Authors. All rights reserved. | |
Use of this source code is governed by a BSD-style | |
license that can be found in the LICENSE file. | |
--> | |
<html> | |
<head> | |
<title></title> | |
<meta charset="UTF-8"> | |
<script src="../../MDV/src/mdv.js"></script> | |
</head> | |
<body> | |
<template> | |
<template bind="{{}}"> | |
Hello from {{source}} | |
</template> | |
</template> | |
<!-- --> | |
<script> | |
var model = { | |
source: 'MDV' | |
}; | |
// does NOT make {{source}} go | |
// HTMLTemplateElement.bindTree(document.body, model); | |
// | |
var t = document.querySelector('template'); | |
var i = t.createInstance(); | |
// | |
// makes {{source}} go | |
HTMLTemplateElement.bindTree(i, model); | |
// | |
document.body.appendChild(i); | |
// | |
// also makes {{source}} go | |
//HTMLTemplateElement.bindTree(i, model); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment