On this page
Overview
Defines the same-origin `<html-import>` loader with open shadow root, inline or packaged external 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 '/node_modules/arcane-os/runtime/arcane/modules/HTMLImport.js';
Import exports the existing html-import registry constructor, or registers and exports the SDK loader when absent. The SDK loader connection callback fetches one same-origin fragment into an open shadow root, sequentially executes inline scripts with host binding, and emits ready or error. Repeated imports reuse the same registered constructor and existing instances.
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 · value | variable default | — |
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('/node_modules/arcane-os/runtime/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.