Skip to content

Instantly share code, notes, and snippets.

@sjmiles
Last active December 15, 2015 11:19
Show Gist options
  • Save sjmiles/5251967 to your computer and use it in GitHub Desktop.
Save sjmiles/5251967 to your computer and use it in GitHub Desktop.
Particular Example Using MDV/ShadowDOM/CustomElements in Concert (Canary Only)
<!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>
@sjmiles
Copy link
Author

sjmiles commented Mar 27, 2013

Requires Canary.

You need to clone the 'platform' repository (https://github.com/toolkitchen/platform) to acquire the 'platform.js' dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment