Created
September 11, 2013 17:43
-
-
Save sorvell/6527156 to your computer and use it in GitHub Desktop.
Failing SD Polyfill distribution
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> | |
<html> | |
<head> | |
<script src="../../../polymer/polymer.js"></script> | |
</head> | |
<body> | |
<template id="host-template"> | |
<div>host shadowRoot</div> | |
<content></content> | |
</template> | |
<template id="inner-host-template"> | |
<div>inner-host shadowRoot</div> | |
</template> | |
<x-host> | |
<x-inner-host></x-inner-host> | |
</x-host> | |
<script> | |
var xHostProto = Object.create(HTMLElement.prototype); | |
xHostProto.createdCallback = function() { | |
this.createShadowRoot(); | |
this.shadowRoot.appendChild(document.querySelector('#host-template').createInstance()); | |
// no problem without template | |
//this.shadowRoot.innerHTML = '<div>host shadowRoot</div><content></content>'; | |
} | |
var xInnerHostProto = Object.create(HTMLElement.prototype); | |
xInnerHostProto.createdCallback = function() { | |
this.createShadowRoot(); | |
this.shadowRoot.appendChild(document.querySelector('#inner-host-template').createInstance()); | |
// no problem without template | |
//this.shadowRoot.innerHTML = '<div>inner-host shadowRoot</div>'; | |
} | |
// no problem without custom elements | |
document.register('x-host', {prototype: xHostProto}); | |
document.register('x-inner-host', {prototype: xInnerHostProto}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment