Last active
December 15, 2015 11:19
-
-
Save sjmiles/5251967 to your computer and use it in GitHub Desktop.
Particular Example Using MDV/ShadowDOM/CustomElements in Concert (Canary Only)
This file contains hidden or 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="../../platform.js"></script> | |
</head> | |
<body> | |
<template> | |
[template start] | |
<template instantiate> | |
[inner template: <content></content>] | |
</template> | |
[template end] | |
</template> | |
<script> | |
var t = document.querySelector('template'); | |
var p = Object.create(HTMLElement.prototype); | |
p.readyCallback = function() { | |
var root = this.webkitCreateShadowRoot(); | |
root.model = {}; | |
root.appendChild(t.createInstance()) | |
} | |
document.register('x-foo', {prototype: p}); | |
</script> | |
<x-foo>x-foo's light dom</x-foo> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires Canary.
You need to clone the 'platform' repository (https://github.com/toolkitchen/platform) to acquire the 'platform.js' dependency.