Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <div id="host"></div>
  <script>
    var inner = document.createElement('div');
    var slot = document.createElement('slot');
    slot.id ='slot';
    inner.appendChild(slot);
    inner.attachShadow({mode: 'open'});
    var innerSlot = document.createElement('slot');
    innerSlot.id ='innerSlot';
    inner.shadowRoot.appendChild(innerSlot);
    host.attachShadow({mode: 'open'});
    host.shadowRoot.appendChild(inner);
    slot.addEventListener('slotchange', function(e) {
      console.log(e, 'bubbled', e.eventPhase === Event.BUBBLING_PHASE);
    });
    innerSlot.addEventListener('slotchange', function(e) {
      console.log(e, 'bubbled', e.eventPhase === Event.BUBBLING_PHASE);
    });
    requestAnimationFrame(function() {
      host.appendChild(document.createElement('a'));
      
    });
  </script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
sorvellpro
0viewers