Skip to content

Instantly share code, notes, and snippets.

@bterlson
Last active August 29, 2015 13:55
Show Gist options
  • Save bterlson/8716397 to your computer and use it in GitHub Desktop.
Save bterlson/8716397 to your computer and use it in GitHub Desktop.
<!doctype html>
<meta charset="utf-8">
<script>
var Platform = {flags: {shadow: 'native'}};
</script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/polymer/0.1.4/platform.js"></script>
<script>
document.registerElement('x-a', {
prototype: {
__proto__: HTMLElement.prototype,
createdCallback: function() {
console.log('created x-a');
},
attachedCallback: function() {
console.log('x-a');
}
}
});
document.registerElement('x-b', {
prototype: {
__proto__: HTMLElement.prototype,
createdCallback: function() {
console.log('created x-b');
},
attachedCallback: function() {
console.log('x-b');
}
}
});
document.addEventListener('DOMContentLoaded', function() {
var doc = document.getElementById('foo').contentDocument;
var elem = doc.createElement('x-a');
var child = doc.createElement('x-b');
elem.appendChild(child);
var adoptedParent = document.adoptNode(elem);
var frag = document.createDocumentFragment();
frag.appendChild(adoptedParent);
document.body.appendChild(frag);
});
</script>
<iframe id="foo"></iframe>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment