From 98c209741df11e26af0400cc0fc9ba49bd452d3f Mon Sep 17 00:00:00 2001 From: Buddy Date: Fri, 6 Nov 2026 21:33:42 -0800 Subject: [PATCH] Throw on wrong-class [selector, Class] refs instead of skipping them --- README.md | 4 ++-- src/types.ts | 6 +++--- src/web-component.ts | 25 ++++++++++++++++++------- test/web-component.test.ts | 28 ++++++++++++++++++++++++---- 4 files changed, 47 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index df71028..2e014be 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ const SPEC = { element: { input: 'input.name', // refs.input: HTMLInputElement | null (from the tag) thing: '.thing', // refs.thing: Element | null (no tag to go on) - card: ['.card', HTMLElement], // refs.card: HTMLElement | null (checked with instanceof) + card: ['.card', HTMLElement], // refs.card: HTMLElement | null (throws if a match isn't one) }, elements: { buttons: 'button' }, // refs.buttons: HTMLButtonElement[] props: { @@ -45,7 +45,7 @@ ExampleElement.observedAttributes; // readonly ('user-id' | 'min' | 'is-ready' | - **Codecs**: `string`, `number`, `enable`, `disable`, `choice([...])`, `json()`, `prop({ default, decode, encode })`. - **Shadow DOM**: `shadow` attaches a root and clones `template` into it; `css` is a shared adopted stylesheet. An existing declarative shadow root is used instead (and `shadow`/`template` are ignored). `root` is the shadow root (even when closed) or the element itself. - **Light DOM**: `template` is appended on first connect; `css` is added once per element type, as a `