Description
Integrating with HTMLElement.attachInternals could enable <trix-editor>
elements to write their contents directly to <form>
and FormData
instances, without the need to write to a related <input type="hidden">
element.
Furthermore, they could set their validity state with attribute validations like [required]
, add support for CSS pseudo-classes like :invalid
and :disabled
, access their assigned <form>
element from callbacks.
There are fairly straightforward paths toward changing the Trix codebase to rely on mechanisms built-into ElementInternals, and some clear wins to be had.
Unfortunately (!), there isn't global support just yet, with Safari as the main hold-out. According to the WebKit Bug Tracker, there have been recent changes aimed at implementing ElementInternals
.
Has there been any discussion about migrating toward using these tools? Would it be possible to start a migration with feature detection checks for partial support, or would it be best to wait until all browser support has landed before getting started?