cotomy 1.0.1 → 1.0.3

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
@@ -50,6 +50,8 @@ The View layer provides thin wrappers around DOM elements and window events.
50
50
  - Identity & matching
51
51
  - `instanceId: string` — Always returns the element's `data-cotomy-instance` (generated when missing, respects existing values)
52
52
  - `id: string | null | undefined`
53
+ - `attached: boolean` — True when the element belongs to the current window document
54
+ - `isConnected: boolean` — True when the element is connected to any document tree (Node.isConnected)
53
55
  - `generateId(prefix = "__cotomy_elem__"): this`
54
56
  - `is(selector: string): boolean` — Parent-aware matching helper
55
57
  - `empty: boolean` — True for tags that cannot have children or have no content
@@ -1115,6 +1115,9 @@ class CotomyElement {
1115
1115
  get attached() {
1116
1116
  return document.contains(this.element);
1117
1117
  }
1118
+ get isConnected() {
1119
+ return this.element.isConnected;
1120
+ }
1118
1121
  get readonly() {
1119
1122
  if ("readOnly" in this.element) {
1120
1123
  return this.element.readOnly;
@@ -1172,7 +1175,7 @@ class CotomyElement {
1172
1175
  if (!this.attached) {
1173
1176
  return false;
1174
1177
  }
1175
- if (!this.element.offsetParent && !document.contains(this.element)) {
1178
+ if (!this.element.offsetParent && !this.attached) {
1176
1179
  return false;
1177
1180
  }
1178
1181
  const rect = this.element.getBoundingClientRect();