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>
<script>
  console.clear();
  class Foo extends HTMLElement {
    connectedCallback() {
      console.log(`rendered: ${this.getAttribute("selected")}`);
    }
  }
  customElements.define("my-foo", Foo)
</script>
  
<script type="module">
  import {toHtml} from "https://esm.sh/hast-util-to-html@9?bundle"
  
  console.log(`serialized: ${toHtml({
    type: "element",
    children: [],
    properties: {
      selected: "some value",
    },
    tagName: "my-foo",
  })}`)
</script>
  
  <my-foo selected="some value"></my-foo>
</body>
</html>
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers