cotomy 1.0.5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -69,7 +69,7 @@ The View layer provides thin wrappers around DOM elements and window events.
69
69
  - `enabled: boolean` (get/set) — Toggles `disabled` attribute
70
70
  - `setFocus(): void`
71
71
  - Tree traversal & manipulation
72
- - `parent: CotomyElement`
72
+ - `parent: CotomyElement` — Returns `CotomyElement.empty()` when no parent element exists (mainly edge cases such as `html` or detached elements)
73
73
  - `parents: CotomyElement[]`
74
74
  - `children(selector = "*", type?): T[]` (direct children only)
75
75
  - `firstChild(selector = "*", type?)`
@@ -83,6 +83,8 @@ The View layer provides thin wrappers around DOM elements and window events.
83
83
  - `clone(type?): CotomyElement` - Returns a deep-cloned element, optionally typed, and reassigns a new `data-cotomy-instance` while preserving the `data-cotomy-scopeid` for scoped CSS sharing (strips `data-cotomy-moving`). Cloning an invalidated element (`data-cotomy-invalidated`) throws.
84
84
  - `clear(): this` — Removes all descendants and text
85
85
  - `remove(): void` — Explicitly non-chainable after removal
86
+
87
+ > Design note: `parent` intentionally returns `CotomyElement` (non-null) for chaining and simpler usage. In typical page structures, missing parent elements are rare (mainly `html` or detached elements), and those cases are represented by `CotomyElement.empty()`.
86
88
  - Geometry & visibility
87
89
  - `visible: boolean`
88
90
  - `width: number` (get/set px)