native-document 1.0.174 → 1.0.176
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "native-document",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.176",
|
|
4
4
|
"description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
|
|
5
5
|
"author": "AfroCodeur <https://github.com/afrocodeur>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -598,7 +598,12 @@ ObservableItem.prototype.persist = function(key, options = {}) {
|
|
|
598
598
|
this.set(value);
|
|
599
599
|
const saver = $saveToStorage(this.$currentValue);
|
|
600
600
|
this.subscribe((newValue) => {
|
|
601
|
-
|
|
601
|
+
const finalValue = options.set ? options.set(newValue) : newValue;
|
|
602
|
+
if(finalValue == null) {
|
|
603
|
+
localStorage.removeItem(key);
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
saver(key, finalValue);
|
|
602
607
|
});
|
|
603
608
|
return this;
|
|
604
609
|
};
|
|
@@ -61,7 +61,7 @@ export const bindStyleAttribute = (element, data) => {
|
|
|
61
61
|
if(isCustomProperty) {
|
|
62
62
|
element.style.setProperty(styleName, value.val());
|
|
63
63
|
value.subscribe((newValue) => {
|
|
64
|
-
if(newValue === false) {
|
|
64
|
+
if(newValue === false || newValue == null) {
|
|
65
65
|
element.style.removeProperty(styleName);
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
@@ -70,7 +70,7 @@ export const bindStyleAttribute = (element, data) => {
|
|
|
70
70
|
} else {
|
|
71
71
|
element.style[styleName] = value.val();
|
|
72
72
|
value.subscribe((newValue) => {
|
|
73
|
-
if(newValue === false) {
|
|
73
|
+
if(newValue === false || newValue == null) {
|
|
74
74
|
element.style.removeProperty(styleName);
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
@@ -137,7 +137,13 @@ export const bindAttributeWithObservable = (element, attributeName, value) => {
|
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
139
|
element.setAttribute(attributeName, value.val());
|
|
140
|
-
value.subscribe((newValue) =>
|
|
140
|
+
value.subscribe((newValue) => {
|
|
141
|
+
if(newValue == null) {
|
|
142
|
+
element.removeAttribute(attributeName);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
element.setAttribute(attributeName, newValue);
|
|
146
|
+
});
|
|
141
147
|
};
|
|
142
148
|
|
|
143
149
|
/**
|
|
@@ -94,7 +94,7 @@ export default function HtmlElementWrapper(name, customWrapper = null, isVoid =
|
|
|
94
94
|
let node = null;
|
|
95
95
|
let createElement = (attr, children) => {
|
|
96
96
|
node = document.createElement(name);
|
|
97
|
-
createElement = elementCreator.
|
|
97
|
+
createElement = (attr, children) => elementCreator(node.cloneNode(), attr, children);
|
|
98
98
|
return elementCreator(node.cloneNode(), attr, children);
|
|
99
99
|
};
|
|
100
100
|
|