Skip to content

Commit

Permalink
issue #52: chrome bug when declaring web-component from another realm
Browse files Browse the repository at this point in the history
  • Loading branch information
caridy committed Jan 10, 2020
1 parent 858f340 commit 7ed0513
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions bugs/chrome-createElement.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<body>
<script>
const sourceText = `
// registering a component in a class that belongs to another realm
top.customElements.define('x-foo', class extends top.HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' }).innerHTML = '<p>worked!</p>';
}
});
`;
const iframe = document.createElement('iframe');
iframe.setAttribute('sandbox', 'allow-same-origin allow-scripts');
document.body.appendChild(iframe);
const { contentWindow } = iframe;
contentWindow.eval(sourceText);
// chrome is failing to create elements indirectly
document.body.innerHTML = '<x-foo></x-foo>';
document.body.appendChild(document.createElement('x-foo'));
// while still works if it is created directly
document.body.appendChild(new (customElements.get('x-foo')));
</script>
</body>

0 comments on commit 7ed0513

Please sign in to comment.