liveBook · Manning

Document.registerElement

As explained in Web Components in Action

document.registerElement is an obsolete browser API formerly used to register custom elements.

document.registerElement is an obsolete browser API formerly used to register custom elements. A-Frame used it with a polyfill to support browsers broadly, rather than using the newer Custom Element API. section 15.2

The API appears in a custom-element design that includes attribute-change callbacks and connected callbacks. A-Frame combines those elements with ordinary inner DOM instead of Shadow DOM. section 15.2

A-Frame’s compatibility layer

An A-Frame page can use an <a-scene> element and edit its 3D contents live in browser developer tools, while the library relies on document.registerElement plus a polyfill behind the scenes. section 15.2

How Web Components in Action covers it

How deep it goes
Identifies the legacy API, polyfill, callbacks, and Shadow DOM distinction but does not detail registration syntax or internals.
Examples
Uses A-Frame’s <a-scene> markup and live developer-tools editing as concrete examples.
What you can do after
Evaluate legacy custom-element implementations and distinguish them from the newer Custom Element API and Shadow DOM.
How it connects
Connects custom elements, Web Components, polyfills, callbacks, Shadow DOM, and A-Frame.

This explainer was generated by Manning's knowledge graph from the text of Web Components in Action. The section links point to the parts of the book it draws on.