wj-elements 0.1.114 → 0.1.115

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.
@@ -612,6 +612,20 @@ const _WJElement = class _WJElement extends HTMLElement {
612
612
  let parts = name.split("-");
613
613
  return [parts.shift(), ...parts.map((n) => n[0].toUpperCase() + n.slice(1))].join("");
614
614
  }
615
+ checkGetterSetter(obj, property) {
616
+ let descriptor = Object.getOwnPropertyDescriptor(obj, property);
617
+ if (descriptor) {
618
+ return {
619
+ hasGetter: typeof descriptor.get === "function" ? descriptor.get : null,
620
+ hasSetter: typeof descriptor.set === "function" ? descriptor.set : null
621
+ };
622
+ }
623
+ let proto = Object.getPrototypeOf(obj);
624
+ if (proto) {
625
+ return this.checkGetterSetter(proto, property);
626
+ }
627
+ return { hasGetter: null, hasSetter: null };
628
+ }
615
629
  /**
616
630
  * Creates one property on this class for every
617
631
  * HTML property defined on the element
@@ -620,13 +634,10 @@ const _WJElement = class _WJElement extends HTMLElement {
620
634
  let attrs = this.getAttributeNames();
621
635
  attrs.forEach((name) => {
622
636
  const sanitizedName = this.sanitizeName(name);
623
- if (sanitizedName in this)
624
- return;
625
- const protoFunc = Object.getOwnPropertyDescriptors(this.__proto__)[sanitizedName];
626
- const func = Object.getOwnPropertyDescriptors(this)[sanitizedName];
637
+ const { hasGetter, hasSetter } = this.checkGetterSetter(this, sanitizedName);
627
638
  Object.defineProperty(this, sanitizedName, {
628
- set: (protoFunc == null ? void 0 : protoFunc.set) ?? (func == null ? void 0 : func.set) ?? ((value) => this.setAttribute(name, value)),
629
- get: (protoFunc == null ? void 0 : protoFunc.get) ?? (func == null ? void 0 : func.get) ?? (() => this.getAttribute(name))
639
+ set: hasSetter ?? ((value) => this.setAttribute(name, value)),
640
+ get: hasGetter ?? (() => this.getAttribute(name))
630
641
  });
631
642
  });
632
643
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wj-elements",
3
3
  "description": "WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development.",
4
- "version": "0.1.114",
4
+ "version": "0.1.115",
5
5
  "homepage": "https://github.com/lencys/wj-elements",
6
6
  "author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
7
7
  "license": "MIT",