From c576682cd42051f1ee59eddb5e97bba22e2631a7 Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Thu, 12 Sep 2024 12:56:16 -0400 Subject: [PATCH 1/6] Update `lowclass` version. --- dist/CustomAttributeRegistry.d.ts | 2 +- dist/CustomAttributeRegistry.d.ts.map | 2 +- package.json | 2 +- src/CustomAttributeRegistry.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/CustomAttributeRegistry.d.ts b/dist/CustomAttributeRegistry.d.ts index 884e61b..a55f9a3 100644 --- a/dist/CustomAttributeRegistry.d.ts +++ b/dist/CustomAttributeRegistry.d.ts @@ -1,4 +1,4 @@ -import type { Constructor } from 'lowclass'; +import type { Constructor } from 'lowclass/dist/Constructor.js'; export declare class CustomAttributeRegistry { ownerDocument: Document | ShadowRoot; private _attrMap; diff --git a/dist/CustomAttributeRegistry.d.ts.map b/dist/CustomAttributeRegistry.d.ts.map index 7139a91..1921e7a 100644 --- a/dist/CustomAttributeRegistry.d.ts.map +++ b/dist/CustomAttributeRegistry.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"CustomAttributeRegistry.d.ts","sourceRoot":"","sources":["../src/CustomAttributeRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,UAAU,CAAA;AAIzC,qBAAa,uBAAuB;IAmBhB,aAAa,EAAE,QAAQ,GAAG,UAAU;IAlBvD,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,WAAW,CAAuD;IAE1E,OAAO,CAAC,SAAS,CAaf;gBAEiB,aAAa,EAAE,QAAQ,GAAG,UAAU;IAIvD,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;IAM3C,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM;IAMtC,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,QAAQ;IAYhB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,U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AAA;IACb,iBAAiB,CAAC,IAAI,IAAI,CAAA;IAC1B,oBAAoB,CAAC,IAAI,IAAI,CAAA;IAC7B,eAAe,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1D"} \ No newline at end of file diff --git a/package.json b/package.json index 7fe1096..ca72c29 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,6 @@ "typescript": "^5.0.0" }, "dependencies": { - "lowclass": "^7.0.0" + "lowclass": "^8.0.0" } } diff --git a/src/CustomAttributeRegistry.ts b/src/CustomAttributeRegistry.ts index 4408571..f3755d3 100644 --- a/src/CustomAttributeRegistry.ts +++ b/src/CustomAttributeRegistry.ts @@ -1,4 +1,4 @@ -import type {Constructor} from 'lowclass' +import type {Constructor} from 'lowclass/dist/Constructor.js' const forEach = Array.prototype.forEach From c2369432b45b0ac3fd7494a9f2877beb224e5275 Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Mon, 16 Sep 2024 15:54:24 -0400 Subject: [PATCH 2/6] update lume/cli --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ca72c29..85ccb78 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ }, "homepage": "https://github.com/matthewp/custom-attributes#readme", "devDependencies": { - "@lume/cli": "^0.11.0", + "@lume/cli": "^0.13.0", "prettier": "3.0.3", "rollup": "^0.41.4", "typescript": "^5.0.0" From b400c044af0b8da759ea53cfa2e36c4a7f907e4a Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Tue, 17 Sep 2024 11:31:22 -0700 Subject: [PATCH 3/6] update build for updated lume/cli --- dist/CustomAttributeRegistry.js.map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/CustomAttributeRegistry.js.map b/dist/CustomAttributeRegistry.js.map index 5ea27c7..a5a129c 100644 --- a/dist/CustomAttributeRegistry.js.map +++ b/dist/CustomAttributeRegistry.js.map @@ -1 +1 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CAAC,gBAAgB;YAAE,IAAI,CAAC,gBAAgB,GAAG,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAA;QAErF,OAAO,IAAI,CAAA;IACZ,CAAC,CAAA;CACD"} \ No newline at end of file +{"version":3,"file":"CustomAttributeRegistry.js","sourceRoot":"","sources":["../src/CustomAttributeRegistry.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,CAAA;AAEvC,MAAM,OAAO,uBAAuB;IAmBhB;IAlBX,QAAQ,GAAG,IAAI,GAAG,EAAuB,CAAA;IACzC,WAAW,GAAG,IAAI,OAAO,EAAyC,CAAA;IAElE,SAAS,GAAqB,IAAI,gBAAgB,CAAC,SAAS,CAAC,EAAE;QACtE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAiB,EAAE,EAAE;YAC7C,IAAI,CAAC,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,aAAc,CAAC,CAAA;gBACnD,IAAI,IAAI;oBAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,aAAc,EAAE,CAAC,CAAC,MAAiB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAA;YAChF,CAAC;YAED,YAAY;iBACP,CAAC;gBACL,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAA;gBACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAA;YACnD,CAAC;QACF,CAAC,CAAC,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,YAAmB,aAAoC;QAApC,kBAAa,GAAb,aAAa,CAAuB;QACtD,IAAI,CAAC,aAAa;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;IAChE,CAAC;IAED,MAAM,CAAC,QAAg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,CAAC,SAAS,CAAC,YAAY,CAAA;IAEpD,OAAO,CAAC,SAAS,CAAC,YAAY,GAAG,SAAS,YAAY,CAAC,OAAO;QAC7D,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAE9C,IAAI,CAAC,IAAI,CAAC,gBAAgB;YAAE,IAAI,CAAC,gBAAgB,GAAG,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAA;QAErF,OAAO,IAAI,CAAA;IACZ,CAAC,CAAA;AACF,CAAC"} \ No newline at end of file From 6e9e670f00a467f592a65dc0c18d4b8401df773e Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Thu, 26 Sep 2024 21:27:55 -0700 Subject: [PATCH 4/6] get tests working --- dist/CustomAttributeRegistry.d.ts | 12 +--- dist/CustomAttributeRegistry.d.ts.map | 2 +- dist/CustomAttributeRegistry.js | 72 +++++++++++----------- dist/CustomAttributeRegistry.js.map | 2 +- dist/test/change.test.d.ts | 2 + dist/test/change.test.d.ts.map | 1 + dist/test/change.test.js | 37 ++++++++++++ dist/test/change.test.js.map | 1 + dist/test/connect.test.d.ts | 5 ++ dist/test/connect.test.d.ts.map | 1 + dist/test/connect.test.js | 47 +++++++++++++++ dist/test/connect.test.js.map | 1 + dist/test/disconnect.test.d.ts | 2 + dist/test/disconnect.test.d.ts.map | 1 + dist/test/disconnect.test.js | 45 ++++++++++++++ dist/test/disconnect.test.js.map | 1 + dist/test/get.test.d.ts | 2 + dist/test/get.test.d.ts.map | 1 + dist/test/get.test.js | 37 ++++++++++++ dist/test/get.test.js.map | 1 + package.json | 2 +- src/CustomAttributeRegistry.ts | 70 ++++++++++----------- src/test/change.test.ts | 51 ++++++++++++++++ src/test/connect.test.ts | 70 +++++++++++++++++++++ src/test/disconnect.test.ts | 63 +++++++++++++++++++ src/test/get.test.ts | 50 +++++++++++++++ test/all.html | 31 ---------- test/change.html | 66 -------------------- test/connect.html | 87 --------------------------- test/disconnect.html | 77 ------------------------ test/get.html | 62 ------------------- 31 files changed, 494 insertions(+), 408 deletions(-) create mode 100644 dist/test/change.test.d.ts create mode 100644 dist/test/change.test.d.ts.map create mode 100644 dist/test/change.test.js create mode 100644 dist/test/change.test.js.map create mode 100644 dist/test/connect.test.d.ts create mode 100644 dist/test/connect.test.d.ts.map create mode 100644 dist/test/connect.test.js create mode 100644 dist/test/connect.test.js.map create mode 100644 dist/test/disconnect.test.d.ts create mode 100644 dist/test/disconnect.test.d.ts.map create mode 100644 dist/test/disconnect.test.js create mode 100644 dist/test/disconnect.test.js.map create mode 100644 dist/test/get.test.d.ts create mode 100644 dist/test/get.test.d.ts.map create mode 100644 dist/test/get.test.js create mode 100644 dist/test/get.test.js.map create mode 100644 src/test/change.test.ts create mode 100644 src/test/connect.test.ts create mode 100644 src/test/disconnect.test.ts create mode 100644 src/test/get.test.ts delete mode 100644 test/all.html delete mode 100644 test/change.html delete mode 100644 test/connect.html delete mode 100644 test/disconnect.html delete mode 100644 test/get.html diff --git a/dist/CustomAttributeRegistry.d.ts b/dist/CustomAttributeRegistry.d.ts index a55f9a3..a41f936 100644 --- a/dist/CustomAttributeRegistry.d.ts +++ b/dist/CustomAttributeRegistry.d.ts @@ -1,20 +1,10 @@ import type { Constructor } from 'lowclass/dist/Constructor.js'; export declare class CustomAttributeRegistry { + #private; ownerDocument: Document | ShadowRoot; - private _attrMap; - private _elementMap; - private _observer; constructor(ownerDocument: Document | ShadowRoot); define(attrName: string, Class: Constructor): void; get(element: Element, attrName: string): CustomAttribute | undefined; - private _getConstructor; - private _observe; - private _unobserve; - private _reobserve; - private _upgradeAttr; - private _elementConnected; - private _elementDisconnected; - private _handleChange; } export interface CustomAttribute { ownerElement: Element; diff --git a/dist/CustomAttributeRegistry.d.ts.map b/dist/CustomAttributeRegistry.d.ts.map index 1921e7a..f52c6d1 100644 --- a/dist/CustomAttributeRegistry.d.ts.map +++ b/dist/CustomAttributeRegistry.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"CustomAttributeRegistry.d.ts","sourceRoot":"","sources":["../src/CustomAttributeRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AAI7D,qBAAa,uBAAuB;IAmBhB,aAAa,EAAE,QAAQ,GAAG,UAAU;IAlBvD,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,WAAW,CAAuD;IAE1E,OAAO,CAAC,SAAS,CAaf;gBAEiB,aAAa,EAAE,QAAQ,GAAG,UAAU;IAIvD,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;IAM3C,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM;IAMtC,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,QAAQ;IAYhB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,iBAAiB,CAWxB;IAED,OAAO,CAAC,oBAAoB,CAO3B;IAED,OAAO,CAAC,aAAa;CAiCrB;AAGD,MAAM,WAAW,eAAe;IAC/B,YAAY,EAAE,OAAO,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,iBAAiB,CAAC,IAAI,IAAI,CAAA;IAC1B,oBAAoB,CAAC,IAAI,IAAI,CAAA;IAC7B,eAAe,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1D"} \ No newline at end of file +{"version":3,"file":"CustomAttributeRegistry.d.ts","sourceRoot":"","sources":["../src/CustomAttributeRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AAI7D,qBAAa,uBAAuB;;IAmBhB,aAAa,EAAE,QAAQ,GAAG,UAAU;gBAApC,aAAa,EAAE,QAAQ,GAAG,UAAU;IAIvD,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;IAM3C,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM;CA8FtC;AAGD,MAAM,WAAW,eAAe;IAC/B,YAAY,EAAE,OAAO,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,iBAAiB,CAAC,IAAI,IAAI,CAAA;IAC1B,oBAAoB,CAAC,IAAI,IAAI,CAAA;IAC7B,eAAe,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1D"} \ No newline at end of file diff --git a/dist/CustomAttributeRegistry.js b/dist/CustomAttributeRegistry.js index 192bd1d..55c0bdd 100644 --- a/dist/CustomAttributeRegistry.js +++ b/dist/CustomAttributeRegistry.js @@ -1,19 +1,19 @@ const forEach = Array.prototype.forEach; export class CustomAttributeRegistry { ownerDocument; - _attrMap = new Map(); - _elementMap = new WeakMap(); - _observer = new MutationObserver(mutations => { + #attrMap = new Map(); + #elementMap = new WeakMap(); + #observer = new MutationObserver(mutations => { forEach.call(mutations, (m) => { if (m.type === 'attributes') { - const attr = this._getConstructor(m.attributeName); + const attr = this.#getConstructor(m.attributeName); if (attr) - this._handleChange(m.attributeName, m.target, m.oldValue); + this.#handleChange(m.attributeName, m.target, m.oldValue); } // chlidList else { - forEach.call(m.removedNodes, this._elementDisconnected); - forEach.call(m.addedNodes, this._elementConnected); + forEach.call(m.removedNodes, this.#elementDisconnected); + forEach.call(m.addedNodes, this.#elementConnected); } }); }); @@ -23,71 +23,71 @@ export class CustomAttributeRegistry { throw new Error('Must be given a document'); } define(attrName, Class) { - this._attrMap.set(attrName, Class); - this._upgradeAttr(attrName); - this._reobserve(); + this.#attrMap.set(attrName, Class); + this.#upgradeAttr(attrName); + this.#reobserve(); } get(element, attrName) { - const map = this._elementMap.get(element); + const map = this.#elementMap.get(element); if (!map) return; return map.get(attrName); } - _getConstructor(attrName) { - return this._attrMap.get(attrName); + #getConstructor(attrName) { + return this.#attrMap.get(attrName); } - _observe() { - this._observer.observe(this.ownerDocument, { + #observe() { + this.#observer.observe(this.ownerDocument, { childList: true, subtree: true, attributes: true, attributeOldValue: true, - attributeFilter: Array.from(this._attrMap.keys()), + attributeFilter: Array.from(this.#attrMap.keys()), // attributeFilter: [...this._attrMap.keys()], // Broken in Oculus // attributeFilter: this._attrMap.keys(), // This works in Chrome, but TS complains, and not clear if it should work in all browsers yet: https://github.com/whatwg/dom/issues/1092 }); } - _unobserve() { - this._observer.disconnect(); + #unobserve() { + this.#observer.disconnect(); } - _reobserve() { - this._unobserve(); - this._observe(); + #reobserve() { + this.#unobserve(); + this.#observe(); } - _upgradeAttr(attrName, node = this.ownerDocument) { + #upgradeAttr(attrName, node = this.ownerDocument) { const matches = node.querySelectorAll('[' + attrName + ']'); // Possibly create custom attributes that may be in the given 'node' tree. // Use a forEach as Edge doesn't support for...of on a NodeList - forEach.call(matches, (element) => this._handleChange(attrName, element, null)); + forEach.call(matches, (element) => this.#handleChange(attrName, element, null)); } - _elementConnected = (element) => { + #elementConnected = (element) => { if (element.nodeType !== 1) return; // For each of the connected element's attribute, possibly instantiate the custom attributes. // Use a forEach as Safari 10 doesn't support for...of on NamedNodeMap (attributes) forEach.call(element.attributes, (attr) => { - if (this._getConstructor(attr.name)) - this._handleChange(attr.name, element, null); + if (this.#getConstructor(attr.name)) + this.#handleChange(attr.name, element, null); }); // Possibly instantiate custom attributes that may be in the subtree of the connected element. - this._attrMap.forEach((_constructor, attr) => this._upgradeAttr(attr, element)); + this.#attrMap.forEach((_constructor, attr) => this.#upgradeAttr(attr, element)); }; - _elementDisconnected = (element) => { - const map = this._elementMap.get(element); + #elementDisconnected = (element) => { + const map = this.#elementMap.get(element); if (!map) return; map.forEach(inst => inst.disconnectedCallback?.(), this); - this._elementMap.delete(element); + this.#elementMap.delete(element); }; - _handleChange(attrName, el, oldVal) { - let map = this._elementMap.get(el); + #handleChange(attrName, el, oldVal) { + let map = this.#elementMap.get(el); if (!map) - this._elementMap.set(el, (map = new Map())); + this.#elementMap.set(el, (map = new Map())); let inst = map.get(attrName); const newVal = el.getAttribute(attrName); // Attribute is being created if (!inst) { - const Constructor = this._getConstructor(attrName); + const Constructor = this.#getConstructor(attrName); inst = new Constructor(); map.set(attrName, inst); inst.ownerElement = el; @@ -114,9 +114,9 @@ export class CustomAttributeRegistry { } // Avoid errors trying to use DOM APIs in non-DOM environments (f.e. server-side rendering). if (globalThis.window?.document) { - const _attachShadow = Element.prototype.attachShadow; + const original = Element.prototype.attachShadow; Element.prototype.attachShadow = function attachShadow(options) { - const root = _attachShadow.call(this, options); + const root = original.call(this, options); if (!root.customAttributes) root.customAttributes = new CustomAttributeRegistry(root); return root; diff --git a/dist/CustomAttributeRegistry.js.map b/dist/CustomAttributeRegistry.js.map index a5a129c..e450257 100644 --- a/dist/CustomAttributeRegistry.js.map +++ b/dist/CustomAttributeRegistry.js.map @@ -1 +1 @@ -{"version":3,"file":"CustomAttributeRegistry.js","sourceRoot":"","sources":["../src/CustomAttributeRegistry.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,CAAA;AAEvC,MAAM,OAAO,uBAAuB;IAmBhB;IAlBX,QAAQ,GAAG,IAAI,GAAG,EAAuB,CAAA;IACzC,WAAW,GAAG,IAAI,OAAO,EAAyC,CAAA;IAElE,SAAS,GAAqB,IAAI,gBAAgB,CAAC,SAAS,CAAC,EAAE;QACtE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAiB,EAAE,EAAE;YAC7C,IAAI,CAAC,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,aAAc,CAAC,CAAA;gBACnD,IAAI,IAAI;oBAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,aAAc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AM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;YACpD,IAAI,CAAC,KAAK,GAAG,MAAM,CAAA;YACnB,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAA;YAC1B,OAAM;QACP,CAAC;QAED,wBAAwB;QACxB,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC,oBAAoB,EAAE,EAAE,CAAA;YAC7B,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QACrB,CAAC;QAED,oBAAoB;aACf,IAAI,MAAM,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;YAChC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAA;YACnB,IAAI,MAAM,IAAI,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;YACpD,IAAI,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACvC,CAAC;IACF,CAAC;CACD;AAYD,4FAA4F;AAC5F,IAAI,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC;IACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,YAAY,CAAA;IAE/C,OAAO,CAAC,SAAS,CAAC,YAAY,GAAG,SAAS,YAAY,CAAC,OAAO;QAC7D,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAEzC,IAAI,CAAC,IAAI,CAAC,gBAAgB;YAAE,IAAI,CAAC,gBAAgB,GAAG,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAA;QAErF,OAAO,IAAI,CAAA;IACZ,CAAC,CAAA;AACF,CAAC"} \ No newline at end of file diff --git a/dist/test/change.test.d.ts b/dist/test/change.test.d.ts new file mode 100644 index 0000000..67a7576 --- /dev/null +++ b/dist/test/change.test.d.ts @@ -0,0 +1,2 @@ +import '../index.js'; +//# sourceMappingURL=change.test.d.ts.map \ No newline at end of file diff --git a/dist/test/change.test.d.ts.map b/dist/test/change.test.d.ts.map new file mode 100644 index 0000000..361162b --- /dev/null +++ b/dist/test/change.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"change.test.d.ts","sourceRoot":"","sources":["../../src/test/change.test.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA"} \ No newline at end of file diff --git a/dist/test/change.test.js b/dist/test/change.test.js new file mode 100644 index 0000000..ba7b8b5 --- /dev/null +++ b/dist/test/change.test.js @@ -0,0 +1,37 @@ +import '../index.js'; +describe('changedCallback()', function () { + async function later() { + await new Promise(r => setTimeout(r, 4)); + } + it('Is called when an attribute changes value', async function () { + const { resolve, promise: changedPromise } = Promise.withResolvers(); + class SomeAttr { + changedCallback() { + resolve(); + } + } + customAttributes.define('some-attr', SomeAttr); + const el = document.createElement('article'); + el.setAttribute('some-attr', 'foo'); + document.body.append(el); + queueMicrotask(() => el.setAttribute('some-attr', 'bar')); + await changedPromise; + el.remove(); + }); + it("Is not called when an attribute's value remains the same", async function () { + let count = 0; + class AnotherAttr { + changedCallback() { + count++; + } + } + customAttributes.define('another-attr', AnotherAttr); + const el = document.createElement('span'); + el.setAttribute('another-attr', 'foo'); + document.body.append(el); + el.setAttribute('another-attr', 'foo'); + await later(); + expect(count).toBe(0); + }); +}); +//# sourceMappingURL=change.test.js.map \ No newline at end of file diff --git a/dist/test/change.test.js.map b/dist/test/change.test.js.map new file mode 100644 index 0000000..4cc3d48 --- /dev/null +++ b/dist/test/change.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"change.test.js","sourceRoot":"","sources":["../../src/test/change.test.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,QAAQ,CAAC,mBAAmB,EAAE;IAC7B,KAAK,UAAU,KAAK;QACnB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IACzC,CAAC;IAED,EAAE,CAAC,2CAA2C,EAAE,KAAK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.ts b/dist/test/connect.test.d.ts new file mode 100644 index 0000000..dc81e37 --- /dev/null +++ b/dist/test/connect.test.d.ts @@ -0,0 +1,5 @@ +import '../index.js'; +declare global { + function expect(...args: any[]): any; +} +//# sourceMappingURL=connect.test.d.ts.map \ No newline at end of file diff --git a/dist/test/connect.test.d.ts.map b/dist/test/connect.test.d.ts.map new file mode 100644 index 0000000..3be0049 --- /dev/null +++ b/dist/test/connect.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"connect.test.d.ts","sourceRoot":"","sources":["../../src/test/connect.test.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,CAAC,MAAM,CAAC;IACd,SAAS,MAAM,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAA;CACpC"} \ No newline at end of file diff --git a/dist/test/connect.test.js b/dist/test/connect.test.js new file mode 100644 index 0000000..b708d64 --- /dev/null +++ b/dist/test/connect.test.js @@ -0,0 +1,47 @@ +import '../index.js'; +class BgColorAttr { + connectedCallback() { + this.setColor(); + } + changedCallback(_oldValue, _newValue) { + this.setColor(); + } + setColor() { + const color = this.value || ''; + this.ownerElement.style.backgroundColor = color; + } +} +document.body.insertAdjacentHTML('beforeend', +/*html*/ ` +
+

This article is static

+
+`); +customAttributes.define('bg-color', BgColorAttr); +describe('connectedCallback()', function () { + it('Is called when element is already in the DOM', function () { + const article = document.querySelector('article'); + expect(article.style.backgroundColor).toBe('red'); + article.remove(); + }); + it('Is called when an attribute is dynamically created', async function () { + const article = document.createElement('article'); + article.textContent = 'hello world'; + document.body.append(article); + article.setAttribute('bg-color', 'blue'); + await new Promise(r => setTimeout(r, 4)); + expect(article.style.backgroundColor).toBe('blue'); + article.remove(); + }); + it('Is called on nested elements when root element is added to the DOM', async function () { + const article = document.createElement('article'); + const header = document.createElement('header'); + header.setAttribute('bg-color', 'blue'); + article.append(header); + document.body.append(article); + await new Promise(r => setTimeout(r, 4)); + expect(header.style.backgroundColor).toBe('blue'); + article.remove(); + }); +}); +//# sourceMappingURL=connect.test.js.map \ No newline at end of file diff --git a/dist/test/connect.test.js.map b/dist/test/connect.test.js.map new file mode 100644 index 0000000..df26525 --- /dev/null +++ b/dist/test/connect.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"connect.test.js","sourceRoot":"","sources":["../../src/test/connect.test.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAMpB,MAAM,WAAW;IAIhB,iBAAiB;QAChB,IAAI,CAAC,QAAQ,EAAE,CAAA;IAChB,CAAC;IAED,eAAe,CAAC,SAAc,EAAE,SAAc;QAC7C,IAAI,CAAC,QAAQ,EAAE,CAAA;IAChB,CAAC;IAED,QAAQ;QACP,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAA;QAC9B,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,eAAe,GAAG,KAAK,CAAA;IAChD,CAAC;CACD;AAED,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAC/B,WAAW;AACX,QAAQ,CAAC;;;;CAIT,CACA,CAAA;AAED,gBAAgB,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,CAAA;AAEhD,QAAQ,CAAC,qBAAqB,EAAE;IAC/B,EAAE,CAAC,8CAA8C,EAAE;QAClD,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAE,CAAA;QAClD,MAAM,CAAC,OAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAClD,OAAO,CAAC,MAAM,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,oDAAoD,EAAE,KAAK;QAC7D,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAA;QACjD,OAAO,CAAC,WAAW,GAAG,aAAa,CAAA;QACnC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAE7B,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;QAExC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAExC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAClD,OAAO,CAAC,MAAM,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,oEAAoE,EAAE,KAAK;QAC7E,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAA;QACjD,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;QAE/C,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;QACvC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAEtB,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAE7B,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAExC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACjD,OAAO,CAAC,MAAM,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/test/disconnect.test.d.ts b/dist/test/disconnect.test.d.ts new file mode 100644 index 0000000..1cd5e91 --- /dev/null +++ b/dist/test/disconnect.test.d.ts @@ -0,0 +1,2 @@ +import '../index.js'; +//# sourceMappingURL=disconnect.test.d.ts.map \ No newline at end of file diff --git a/dist/test/disconnect.test.d.ts.map b/dist/test/disconnect.test.d.ts.map new file mode 100644 index 0000000..5b603d8 --- /dev/null +++ b/dist/test/disconnect.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"disconnect.test.d.ts","sourceRoot":"","sources":["../../src/test/disconnect.test.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA"} \ No newline at end of file diff --git a/dist/test/disconnect.test.js b/dist/test/disconnect.test.js new file mode 100644 index 0000000..f38108b --- /dev/null +++ b/dist/test/disconnect.test.js @@ -0,0 +1,45 @@ +import '../index.js'; +describe('disconnectedCallback()', function () { + async function later() { + await new Promise(r => setTimeout(r, 4)); + } + it('Is called when removeAttribute() is used', async function () { + const { resolve, promise: disconnectedPromise } = Promise.withResolvers(); + let count = 0; + class MyAttr { + async connectedCallback() { + await later().then(() => el.removeAttribute('my-attr')); + } + changedCallback() { + count++; + } + disconnectedCallback() { + resolve(); + } + } + customAttributes.define('my-attr', MyAttr); + const el = document.createElement('span'); + document.body.append(el); + queueMicrotask(() => el.setAttribute('my-attr', 'test')); + await disconnectedPromise; + expect(count).toBe(0); + }); + it('Is called when the element is removed', async function () { + const { resolve, promise: disconnectedPromise } = Promise.withResolvers(); + class SomeAttr { + async connectedCallback() { + await later(); + el.remove(); + } + disconnectedCallback() { + resolve(); + } + } + customAttributes.define('some-attr', SomeAttr); + const el = document.createElement('span'); + document.body.append(el); + queueMicrotask(() => el.setAttribute('some-attr', 'test')); + await disconnectedPromise; + }); +}); +//# sourceMappingURL=disconnect.test.js.map \ No newline at end of file diff --git a/dist/test/disconnect.test.js.map b/dist/test/disconnect.test.js.map new file mode 100644 index 0000000..987ea8e --- /dev/null +++ b/dist/test/disconnect.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"disconnect.test.js","sourceRoot":"","sources":["../../src/test/disconnect.test.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,QAAQ,CAAC,wBAAwB,EAAE;IAClC,KAAK,UAAU,KAAK;QACnB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC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,CAAA;QAE9C,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QACzC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QAExB,cAAc,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAA;QAE1D,MAAM,mBAAmB,CAAA;IAC1B,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/test/get.test.d.ts b/dist/test/get.test.d.ts new file mode 100644 index 0000000..1c06818 --- /dev/null +++ b/dist/test/get.test.d.ts @@ -0,0 +1,2 @@ +import '../index.js'; +//# sourceMappingURL=get.test.d.ts.map \ No newline at end of file diff --git a/dist/test/get.test.d.ts.map b/dist/test/get.test.d.ts.map new file mode 100644 index 0000000..132c6d0 --- /dev/null +++ b/dist/test/get.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"get.test.d.ts","sourceRoot":"","sources":["../../src/test/get.test.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA"} \ No newline at end of file diff --git a/dist/test/get.test.js b/dist/test/get.test.js new file mode 100644 index 0000000..925937f --- /dev/null +++ b/dist/test/get.test.js @@ -0,0 +1,37 @@ +import '../index.js'; +describe('get()', function () { + async function later() { + await new Promise(r => setTimeout(r, 4)); + } + it('gets the attribute instance', async function () { + class Foobar { + } + customAttributes.define('foo-bar', Foobar); + const el = document.createElement('span'); + el.setAttribute('foo-bar', 'baz'); + document.body.append(el); + await later(); + const fooBar = customAttributes.get(el, 'foo-bar'); + expect(fooBar).toBeInstanceOf(Foobar); + }); + it('allows passing more complex data types', async function () { + const { resolve, promise: bazSetPromise } = Promise.withResolvers(); + class Foobar { + set baz(val) { + expect(val).toBe('hello world'); + resolve(); + } + } + customAttributes.define('foo-bar', Foobar); + const el = document.createElement('span'); + el.setAttribute('foo-bar', 'bam'); + document.body.append(el); + await later(); + const fooBar = customAttributes.get(el, 'foo-bar'); + queueMicrotask(() => + // @ts-expect-error TODO make a CustomAttributes map for registering global attribute types. + (fooBar.baz = 'hello world')); + await bazSetPromise; + }); +}); +//# sourceMappingURL=get.test.js.map \ No newline at end of file diff --git a/dist/test/get.test.js.map b/dist/test/get.test.js.map new file mode 100644 index 0000000..7bf7fd3 --- /dev/null +++ b/dist/test/get.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"get.test.js","sourceRoot":"","sources":["../../src/test/get.test.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,QAAQ,CAAC,OAAO,EAAE;IACjB,KAAK,UAAU,KAAK;QACnB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IACzC,CAAC;IAED,EAAE,CAAC,6BAA6B,EAAE,KAAK;QACtC,MAAM,MAAM;SAAG;QACf,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;QAE1C,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QACzC,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QACjC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QAExB,MAAM,KAAK,EAAE,CAAA;QAEb,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,CAAA;QAClD,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;IACtC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wCAAwC,EAAE,KAAK;QACjD,MAAM,EAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAC,GAAG,OAAO,CAAC,aAAa,EAAQ,CAAA;QAEvE,MAAM,MAAM;YACX,IAAI,GAAG,CAAC,GAAQ;gBACf,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;gBAC/B,OAAO,EAAE,CAAA;YACV,CAAC;SACD;QAED,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;QAE1C,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QACzC,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QACjC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QAExB,MAAM,KAAK,EAAE,CAAA;QAEb,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,CAAA;QAElD,cAAc,CACb,GAAG,EAAE;QACJ,4FAA4F;QAC5F,CAAC,MAAO,CAAC,GAAG,GAAG,aAAa,CAAC,CAC9B,CAAA;QAED,MAAM,aAAa,CAAA;IACpB,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/package.json b/package.json index 85ccb78..81a2347 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "dev": "lume dev", "typecheck": "lume typecheck", "typecheck:watch": "lume typecheckWatch", - "test": "echo TODO use 'lume test'", + "test": "lume test", "test:watch": "lume test --watch", "prettier": "lume prettier", "prettier:check": "lume prettierCheck", diff --git a/src/CustomAttributeRegistry.ts b/src/CustomAttributeRegistry.ts index f3755d3..ee3d277 100644 --- a/src/CustomAttributeRegistry.ts +++ b/src/CustomAttributeRegistry.ts @@ -3,20 +3,20 @@ import type {Constructor} from 'lowclass/dist/Constructor.js' const forEach = Array.prototype.forEach export class CustomAttributeRegistry { - private _attrMap = new Map() - private _elementMap = new WeakMap>() + #attrMap = new Map() + #elementMap = new WeakMap>() - private _observer: MutationObserver = new MutationObserver(mutations => { + #observer: MutationObserver = new MutationObserver(mutations => { forEach.call(mutations, (m: MutationRecord) => { if (m.type === 'attributes') { - const attr = this._getConstructor(m.attributeName!) - if (attr) this._handleChange(m.attributeName!, m.target as Element, m.oldValue) + const attr = this.#getConstructor(m.attributeName!) + if (attr) this.#handleChange(m.attributeName!, m.target as Element, m.oldValue) } // chlidList else { - forEach.call(m.removedNodes, this._elementDisconnected) - forEach.call(m.addedNodes, this._elementConnected) + forEach.call(m.removedNodes, this.#elementDisconnected) + forEach.call(m.addedNodes, this.#elementConnected) } }) }) @@ -26,82 +26,82 @@ export class CustomAttributeRegistry { } define(attrName: string, Class: Constructor) { - this._attrMap.set(attrName, Class) - this._upgradeAttr(attrName) - this._reobserve() + this.#attrMap.set(attrName, Class) + this.#upgradeAttr(attrName) + this.#reobserve() } get(element: Element, attrName: string) { - const map = this._elementMap.get(element) + const map = this.#elementMap.get(element) if (!map) return return map.get(attrName) } - private _getConstructor(attrName: string) { - return this._attrMap.get(attrName) + #getConstructor(attrName: string) { + return this.#attrMap.get(attrName) } - private _observe() { - this._observer.observe(this.ownerDocument, { + #observe() { + this.#observer.observe(this.ownerDocument, { childList: true, subtree: true, attributes: true, attributeOldValue: true, - attributeFilter: Array.from(this._attrMap.keys()), + attributeFilter: Array.from(this.#attrMap.keys()), // attributeFilter: [...this._attrMap.keys()], // Broken in Oculus // attributeFilter: this._attrMap.keys(), // This works in Chrome, but TS complains, and not clear if it should work in all browsers yet: https://github.com/whatwg/dom/issues/1092 }) } - private _unobserve() { - this._observer.disconnect() + #unobserve() { + this.#observer.disconnect() } - private _reobserve() { - this._unobserve() - this._observe() + #reobserve() { + this.#unobserve() + this.#observe() } - private _upgradeAttr(attrName: string, node: Element | Document | ShadowRoot = this.ownerDocument) { + #upgradeAttr(attrName: string, node: Element | Document | ShadowRoot = this.ownerDocument) { const matches = node.querySelectorAll('[' + attrName + ']') // Possibly create custom attributes that may be in the given 'node' tree. // Use a forEach as Edge doesn't support for...of on a NodeList - forEach.call(matches, (element: Element) => this._handleChange(attrName, element, null)) + forEach.call(matches, (element: Element) => this.#handleChange(attrName, element, null)) } - private _elementConnected = (element: Element) => { + #elementConnected = (element: Element) => { if (element.nodeType !== 1) return // For each of the connected element's attribute, possibly instantiate the custom attributes. // Use a forEach as Safari 10 doesn't support for...of on NamedNodeMap (attributes) forEach.call(element.attributes, (attr: Attr) => { - if (this._getConstructor(attr.name)) this._handleChange(attr.name, element, null) + if (this.#getConstructor(attr.name)) this.#handleChange(attr.name, element, null) }) // Possibly instantiate custom attributes that may be in the subtree of the connected element. - this._attrMap.forEach((_constructor, attr) => this._upgradeAttr(attr, element)) + this.#attrMap.forEach((_constructor, attr) => this.#upgradeAttr(attr, element)) } - private _elementDisconnected = (element: Element) => { - const map = this._elementMap.get(element) + #elementDisconnected = (element: Element) => { + const map = this.#elementMap.get(element) if (!map) return map.forEach(inst => inst.disconnectedCallback?.(), this) - this._elementMap.delete(element) + this.#elementMap.delete(element) } - private _handleChange(attrName: string, el: Element, oldVal: string | null) { - let map = this._elementMap.get(el) - if (!map) this._elementMap.set(el, (map = new Map())) + #handleChange(attrName: string, el: Element, oldVal: string | null) { + let map = this.#elementMap.get(el) + if (!map) this.#elementMap.set(el, (map = new Map())) let inst = map.get(attrName) const newVal = el.getAttribute(attrName) // Attribute is being created if (!inst) { - const Constructor = this._getConstructor(attrName)! + const Constructor = this.#getConstructor(attrName)! inst = new Constructor() as CustomAttribute map.set(attrName, inst) inst.ownerElement = el @@ -139,10 +139,10 @@ export interface CustomAttribute { // Avoid errors trying to use DOM APIs in non-DOM environments (f.e. server-side rendering). if (globalThis.window?.document) { - const _attachShadow = Element.prototype.attachShadow + const original = Element.prototype.attachShadow Element.prototype.attachShadow = function attachShadow(options) { - const root = _attachShadow.call(this, options) + const root = original.call(this, options) if (!root.customAttributes) root.customAttributes = new CustomAttributeRegistry(root) diff --git a/src/test/change.test.ts b/src/test/change.test.ts new file mode 100644 index 0000000..d30b024 --- /dev/null +++ b/src/test/change.test.ts @@ -0,0 +1,51 @@ +import '../index.js' + +describe('changedCallback()', function () { + async function later() { + await new Promise(r => setTimeout(r, 4)) + } + + it('Is called when an attribute changes value', async function () { + const {resolve, promise: changedPromise} = Promise.withResolvers() + + class SomeAttr { + changedCallback() { + resolve() + } + } + + customAttributes.define('some-attr', SomeAttr) + + const el = document.createElement('article') + el.setAttribute('some-attr', 'foo') + document.body.append(el) + + queueMicrotask(() => el.setAttribute('some-attr', 'bar')) + + await changedPromise + + el.remove() + }) + + it("Is not called when an attribute's value remains the same", async function () { + let count = 0 + + class AnotherAttr { + changedCallback() { + count++ + } + } + + customAttributes.define('another-attr', AnotherAttr) + + const el = document.createElement('span') + el.setAttribute('another-attr', 'foo') + document.body.append(el) + + el.setAttribute('another-attr', 'foo') + + await later() + + expect(count).toBe(0) + }) +}) diff --git a/src/test/connect.test.ts b/src/test/connect.test.ts new file mode 100644 index 0000000..23b0f7d --- /dev/null +++ b/src/test/connect.test.ts @@ -0,0 +1,70 @@ +import '../index.js' + +declare global { + function expect(...args: any[]): any +} + +class BgColorAttr { + declare value: any + declare ownerElement: any + + connectedCallback() { + this.setColor() + } + + changedCallback(_oldValue: any, _newValue: any) { + this.setColor() + } + + setColor() { + const color = this.value || '' + this.ownerElement.style.backgroundColor = color + } +} + +document.body.insertAdjacentHTML( + 'beforeend', + /*html*/ ` +
+

This article is static

+
+`, +) + +customAttributes.define('bg-color', BgColorAttr) + +describe('connectedCallback()', function () { + it('Is called when element is already in the DOM', function () { + const article = document.querySelector('article')! + expect(article!.style.backgroundColor).toBe('red') + article.remove() + }) + + it('Is called when an attribute is dynamically created', async function () { + const article = document.createElement('article') + article.textContent = 'hello world' + document.body.append(article) + + article.setAttribute('bg-color', 'blue') + + await new Promise(r => setTimeout(r, 4)) + + expect(article.style.backgroundColor).toBe('blue') + article.remove() + }) + + it('Is called on nested elements when root element is added to the DOM', async function () { + const article = document.createElement('article') + const header = document.createElement('header') + + header.setAttribute('bg-color', 'blue') + article.append(header) + + document.body.append(article) + + await new Promise(r => setTimeout(r, 4)) + + expect(header.style.backgroundColor).toBe('blue') + article.remove() + }) +}) diff --git a/src/test/disconnect.test.ts b/src/test/disconnect.test.ts new file mode 100644 index 0000000..56977aa --- /dev/null +++ b/src/test/disconnect.test.ts @@ -0,0 +1,63 @@ +import '../index.js' + +describe('disconnectedCallback()', function () { + async function later() { + await new Promise(r => setTimeout(r, 4)) + } + + it('Is called when removeAttribute() is used', async function () { + const {resolve, promise: disconnectedPromise} = Promise.withResolvers() + + let count = 0 + + class MyAttr { + async connectedCallback() { + await later().then(() => el.removeAttribute('my-attr')) + } + + changedCallback() { + count++ + } + + disconnectedCallback() { + resolve() + } + } + + customAttributes.define('my-attr', MyAttr) + + const el = document.createElement('span') + document.body.append(el) + + queueMicrotask(() => el.setAttribute('my-attr', 'test')) + + await disconnectedPromise + + expect(count).toBe(0) + }) + + it('Is called when the element is removed', async function () { + const {resolve, promise: disconnectedPromise} = Promise.withResolvers() + + class SomeAttr { + async connectedCallback() { + await later() + + el.remove() + } + + disconnectedCallback() { + resolve() + } + } + + customAttributes.define('some-attr', SomeAttr) + + const el = document.createElement('span') + document.body.append(el) + + queueMicrotask(() => el.setAttribute('some-attr', 'test')) + + await disconnectedPromise + }) +}) diff --git a/src/test/get.test.ts b/src/test/get.test.ts new file mode 100644 index 0000000..6889291 --- /dev/null +++ b/src/test/get.test.ts @@ -0,0 +1,50 @@ +import '../index.js' + +describe('get()', function () { + async function later() { + await new Promise(r => setTimeout(r, 4)) + } + + it('gets the attribute instance', async function () { + class Foobar {} + customAttributes.define('foo-bar', Foobar) + + const el = document.createElement('span') + el.setAttribute('foo-bar', 'baz') + document.body.append(el) + + await later() + + const fooBar = customAttributes.get(el, 'foo-bar') + expect(fooBar).toBeInstanceOf(Foobar) + }) + + it('allows passing more complex data types', async function () { + const {resolve, promise: bazSetPromise} = Promise.withResolvers() + + class Foobar { + set baz(val: any) { + expect(val).toBe('hello world') + resolve() + } + } + + customAttributes.define('foo-bar', Foobar) + + const el = document.createElement('span') + el.setAttribute('foo-bar', 'bam') + document.body.append(el) + + await later() + + const fooBar = customAttributes.get(el, 'foo-bar') + + queueMicrotask( + () => + // @ts-expect-error TODO make a CustomAttributes map for registering global attribute types. + (fooBar!.baz = 'hello world'), + ) + + await bazSetPromise + }) +}) diff --git a/test/all.html b/test/all.html deleted file mode 100644 index 59da15f..0000000 --- a/test/all.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - custom-attributes tests - - - -
- - -
-
- - -
- - diff --git a/test/change.html b/test/change.html deleted file mode 100644 index 751033d..0000000 --- a/test/change.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - changedCallback() tests - - - - - - -
- - - - - diff --git a/test/connect.html b/test/connect.html deleted file mode 100644 index f35f8cd..0000000 --- a/test/connect.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - simple test - - - - - - -
-

This article is static

-
- -
- - - - - - - - diff --git a/test/disconnect.html b/test/disconnect.html deleted file mode 100644 index e455cf6..0000000 --- a/test/disconnect.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - disconnectedCallback() tests - - - - - - -
- - - - - - diff --git a/test/get.html b/test/get.html deleted file mode 100644 index 5d1e39c..0000000 --- a/test/get.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - get() tests - - - - - - -
- - - - - From 99733ea047d84dc4c5304b1a816cc051187a4248 Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Thu, 26 Sep 2024 21:41:43 -0700 Subject: [PATCH 5/6] run tests in windows --- .github/workflows/tests.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b5a4539..927f363 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,9 +8,7 @@ jobs: strategy: matrix: - # TODO get tests working in Windows too - # windows-latest - operating-system: [ubuntu-latest, macos-latest] + operating-system: [ubuntu-latest, windows-latest, macos-latest] steps: - uses: actions/checkout@v1 From 12f23bc31cca233cd628b0cfefa286d6f5c96a68 Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Thu, 26 Sep 2024 21:47:05 -0700 Subject: [PATCH 6/6] update comment --- dist/CustomAttributeRegistry.js | 4 ++-- src/CustomAttributeRegistry.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/CustomAttributeRegistry.js b/dist/CustomAttributeRegistry.js index 55c0bdd..af4033d 100644 --- a/dist/CustomAttributeRegistry.js +++ b/dist/CustomAttributeRegistry.js @@ -43,8 +43,8 @@ export class CustomAttributeRegistry { attributes: true, attributeOldValue: true, attributeFilter: Array.from(this.#attrMap.keys()), - // attributeFilter: [...this._attrMap.keys()], // Broken in Oculus - // attributeFilter: this._attrMap.keys(), // This works in Chrome, but TS complains, and not clear if it should work in all browsers yet: https://github.com/whatwg/dom/issues/1092 + // attributeFilter: [...this.#attrMap.keys()], // Broken in Oculus + // attributeFilter: this.#attrMap.keys(), // This works in Chrome, but TS complains, and not clear if it should work in all browsers yet: https://github.com/whatwg/dom/issues/1092 }); } #unobserve() { diff --git a/src/CustomAttributeRegistry.ts b/src/CustomAttributeRegistry.ts index ee3d277..05644c1 100644 --- a/src/CustomAttributeRegistry.ts +++ b/src/CustomAttributeRegistry.ts @@ -48,8 +48,8 @@ export class CustomAttributeRegistry { attributes: true, attributeOldValue: true, attributeFilter: Array.from(this.#attrMap.keys()), - // attributeFilter: [...this._attrMap.keys()], // Broken in Oculus - // attributeFilter: this._attrMap.keys(), // This works in Chrome, but TS complains, and not clear if it should work in all browsers yet: https://github.com/whatwg/dom/issues/1092 + // attributeFilter: [...this.#attrMap.keys()], // Broken in Oculus + // attributeFilter: this.#attrMap.keys(), // This works in Chrome, but TS complains, and not clear if it should work in all browsers yet: https://github.com/whatwg/dom/issues/1092 }) }