) {
  const element = document.querySelector('custom-element');

  assert(!element.upgraded);

  customElements.define('custom-element', class extends HTMLElement {
    constructor() {
      super();
      this.upgraded = true;
    }
  });

  assert(element.upgraded);
});
</script>
</head>
<body>
  <custom-element></custom-element>
</body>
</html>
