On this page
Overview
Defines the same-origin `<html-import>` loader with open shadow root, inline script execution, and readiness/error events.
- Artifact
HTMLImport.js· esm - Classification
public first party - Availability
Browser / native WebView - Normalization
Public error detail normalized; fetch/DOM failure preserved.
Import and lifecycle
import htmlImport from '/arcane/modules/HTMLImport.js';
Import registers html-import; connection fetches one same-origin fragment into an open shadow root, sequentially executes inline scripts with host binding, and emits ready or error.
Application-facing behavior: default HTMLImport; registers html-import; connectedCallback() and ready.
Protocol and host implementation
Same-origin fetch + DOM This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
default | default · class | class HTMLImport extends HTMLElement | — |
| Callable | Kind | Exact public signature | Parameter syntax |
|---|---|---|---|
HTMLImport.connectedCallback | public-member | connectedCallback() | — |
| Member | Kind | Exact public declaration | Parameter syntax |
|---|---|---|---|
HTMLImport.constructor | constructor | constructor() | — |
HTMLImport.ready | field | ready=false; | — |
HTMLImport.connectedCallback | method | connectedCallback() | — |
HTMLImport.disconnectedCallback | method | disconnectedCallback() | — |
Parameter meanings and results
Set href before connecting; ready becomes true after a successful 2xx load and inline-script completion. An external script src is logged and stops further script execution; cross-origin URLs, redirects, fetch, DOM, and script failures become a bounded public error detail.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
- html-import-ready
- html-import-error
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- HTML_IMPORT_FAILED in error event detail
- underlying failure is caught and logged
Availability and capabilities
Browser / native WebView. Public error detail normalized; fetch/DOM failure preserved.
Browser and native-WebView same-origin component loader with no Core service; its protocol is fetch plus DOM, not ESM normalization.
Contract example
await import('/arcane/modules/HTMLImport.js');
const component=document.createElement('html-import');
component.setAttribute('href','./component.html');
component.addEventListener('html-import-ready',event=>console.log(event.detail),{once:true});
component.addEventListener('html-import-error',event=>console.error(event.detail),{once:true});
document.body.append(component);
Related reference
No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.