cotomy 1.0.0 → 1.0.2

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,7 @@ 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 is connected to a document
53
54
  - `generateId(prefix = "__cotomy_elem__"): this`
54
55
  - `is(selector: string): boolean` — Parent-aware matching helper
55
56
  - `empty: boolean` — True for tags that cannot have children or have no content
@@ -1113,7 +1113,7 @@ class CotomyElement {
1113
1113
  || this._element.innerHTML.trim() === "";
1114
1114
  }
1115
1115
  get attached() {
1116
- return document.contains(this.element);
1116
+ return this.element.isConnected;
1117
1117
  }
1118
1118
  get readonly() {
1119
1119
  if ("readOnly" in this.element) {
@@ -1172,7 +1172,7 @@ class CotomyElement {
1172
1172
  if (!this.attached) {
1173
1173
  return false;
1174
1174
  }
1175
- if (!this.element.offsetParent && !document.contains(this.element)) {
1175
+ if (!this.element.offsetParent && !this.attached) {
1176
1176
  return false;
1177
1177
  }
1178
1178
  const rect = this.element.getBoundingClientRect();
@@ -2615,7 +2615,7 @@ class CotomyApi {
2615
2615
  return this._options.mode || 'cors';
2616
2616
  }
2617
2617
  get keepalive() {
2618
- return this._options.keepalive || true;
2618
+ return this._options.keepalive ?? true;
2619
2619
  }
2620
2620
  get integrity() {
2621
2621
  return this._options.integrity || '';