Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html-element-property-mixins

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-element-property-mixins - npm Package Compare versions

Comparing version 0.9.2 to 0.9.3

2

package.json
{
"name": "html-element-property-mixins",
"version": "0.9.2",
"version": "0.9.3",
"description": "A collection of mixins extending HTMLElement with properties.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -16,3 +16,3 @@ export const ObservedProperties = (SuperClass) => class extends SuperClass {

this.constructor.__initialPropertyValues = new Map();
this.constructor.observedProperties.map(propName => this.constructor.__initialPropertyValues.set(propName, this[propName]));
(this.constructor.observedProperties || []).map(propName => this.constructor.__initialPropertyValues.set(propName, this[propName]));
}

@@ -27,3 +27,4 @@

static __initProperties() {
const observedProps = this.constructor.observedProperties || {};
this.constructor.__propertyAccessors = {};
const observedProps = this.constructor.observedProperties || [];
observedProps.map(propName => this.constructor.__initProperty.call(this, propName));

@@ -33,2 +34,3 @@ }

static __initProperty(propName) {
this.constructor.__propertyAccessors[propName] = this.__getPropertyDescriptor(this, propName);
Object.defineProperty(this, propName, {

@@ -41,3 +43,3 @@ set(val) { this.constructor.__setProperty.call(this, propName, val); },

static __getProperty(propName) {
const customAccessors = Object.getOwnPropertyDescriptors(this.constructor.prototype)[propName] || {};
const customAccessors = this.constructor.__propertyAccessors[propName] || {};
if(customAccessors.get) return customAccessors.get.call(this, propName);

@@ -48,3 +50,3 @@ return this[`#${propName}`];

static __setProperty(propName, newValue) {
const customAccessors = Object.getOwnPropertyDescriptors(this.constructor.prototype)[propName] || {};
const customAccessors = this.constructor.__propertyAccessors[propName] || {};
const oldValue = this[propName];

@@ -61,2 +63,7 @@ if(customAccessors.set) customAccessors.set.call(this, newValue);

__getPropertyDescriptor(obj, key) {
if(!obj) return;
return Object.getOwnPropertyDescriptor(obj, key) || this.__getPropertyDescriptor(Object.getPrototypeOf(obj), key)
}
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc