html-element-property-mixins
Advanced tools
Comparing version 0.10.2 to 0.10.3
{ | ||
"name": "html-element-property-mixins", | ||
"version": "0.10.2", | ||
"version": "0.10.3", | ||
"description": "A collection of mixins extending HTMLElement with properties.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -290,4 +290,4 @@ # # html-element-property-mixins | ||
attributeName: 'first-name', //map to custom attribute name, | ||
toAttributeConverter: ParseString.toAttribute, //run when converting to attribute | ||
fromAttributeConverter: ParseString.fromAttribute //run when converting from attribute | ||
toAttributeConverter: StringConverter.toAttribute, //run when converting to attribute | ||
fromAttributeConverter: StringConverter.fromAttribute //run when converting from attribute | ||
} | ||
@@ -436,2 +436,2 @@ } | ||
> **Note**: `PropertiesChangedHandler` should always be used in conjunction with `ObservedProperties`. | ||
> **Note**: `PropertiesChangedHandler` should always be used in conjunction with `ObservedProperties`. |
@@ -30,7 +30,7 @@ export const DOMProperties = (SuperClass) => class extends SuperClass { | ||
this.getAttributeNames().map(attrName => attrValues.set(attrName, this.getAttribute(attrName))); | ||
this.constructor.__initialAttributeValues = attrValues; | ||
this.__initialAttributeValues = attrValues; | ||
} | ||
static __setInitialAttributeValues() { | ||
const attrValues = this.constructor.__initialAttributeValues; | ||
const attrValues = this.__initialAttributeValues; | ||
attrValues.forEach((val, attrName) => this.setAttribute(attrName, val)); | ||
@@ -37,0 +37,0 @@ } |
@@ -16,8 +16,8 @@ export const ObservedProperties = (SuperClass) => class extends SuperClass { | ||
static __saveInitialPropertyValues() { | ||
this.constructor.__initialPropertyValues = new Map(); | ||
(this.constructor.observedProperties || []).map(propName => this.constructor.__initialPropertyValues.set(propName, this[propName])); | ||
this.__initialPropertyValues = new Map(); | ||
(this.constructor.observedProperties || []).map(propName => this.__initialPropertyValues.set(propName, this[propName])); | ||
} | ||
static __setInitialPropertyValues() { | ||
this.constructor.__initialPropertyValues.forEach((val, propName) => { | ||
this.__initialPropertyValues.forEach((val, propName) => { | ||
if(val !== undefined) this[propName] = val; | ||
@@ -24,0 +24,0 @@ }); |
436
43833