Capability first · transport second

HTMLImport.js

Defines the same-origin loader with open shadow root, inline script execution, and readiness/error events.

SDK 0.5.18Runtime 0.8.12Protocol arcane/1
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

JavaScript
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

BindingFormDeclaration or signatureParameter syntax
defaultdefault · classclass HTMLImport extends HTMLElement
CallableKindExact public signatureParameter syntax
HTMLImport.connectedCallbackpublic-memberconnectedCallback()
MemberKindExact public declarationParameter syntax
HTMLImport.constructorconstructorconstructor()
HTMLImport.readyfieldready=false;
HTMLImport.connectedCallbackmethodconnectedCallback()
HTMLImport.disconnectedCallbackmethoddisconnectedCallback()

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

JavaScript
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);

No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.