Skip to content

Instantly share code, notes, and snippets.

@sorvell
Created September 11, 2013 19:48
Show Gist options
  • Save sorvell/6528827 to your computer and use it in GitHub Desktop.
Save sorvell/6528827 to your computer and use it in GitHub Desktop.
ShadowDOM Polyfill distribution failure
<!DOCTYPE html>
<html>
<head>
<script src="../../../polymer/polymer.js"></script>
</head>
<body>
<x-host>
<x-inner-host></x-inner-host>
</x-host>
<script>
function makeSR(selector, html) {
var node = document.querySelector(selector);
if (node) {
node.createShadowRoot().innerHTML = html;
}
}
makeSR('x-inner-host', '<div>inner-host shadowRoot</div>');
// note: this must be created last and the content must have whitespace
// after it.
makeSR('x-host', '<div>host shadowRoot</div><content></content> ');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment