Last active
August 29, 2015 13:55
-
-
Save bterlson/8716397 to your computer and use it in GitHub Desktop.
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> | |
<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