<form>
<my-ce name="foo"></my-ce>
</form>
<script>
class MyCe extends HTMLElement {
static formAssociated = true
constructor() {
super()
this._internals = this.attachInternals()
}
connectedCallback() {
this._internals.setFormValue('Hello, World!')
}
}
customElements.define('my-ce', MyCe)
</script>