arche 0.3.8 → 0.3.9
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/es.js +8 -1
- package/index.js +8 -1
- package/index.mjs +8 -1
- package/package.json +1 -1
- package/test.js +2 -1
package/es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Arche v0.3.
|
|
2
|
+
* Arche v0.3.9
|
|
3
3
|
* https://github.com/richytong/arche
|
|
4
4
|
* (c) 2020-2023 Richard Tong
|
|
5
5
|
* Arche may be freely distributed under the MIT license.
|
|
@@ -25,6 +25,13 @@ const elementSetAttribute = function (element, key, value) {
|
|
|
25
25
|
if (value == null) { // boolean
|
|
26
26
|
element.setAttribute(key, value)
|
|
27
27
|
}
|
|
28
|
+
else if (typeof value == 'boolean') {
|
|
29
|
+
if (value) {
|
|
30
|
+
element.setAttribute(key, key)
|
|
31
|
+
} else {
|
|
32
|
+
element.removeAttribute(key)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
28
35
|
else if (value.constructor == Object) { // style
|
|
29
36
|
for (const subKey in value) {
|
|
30
37
|
element[key][subKey] = value[subKey]
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Arche v0.3.
|
|
2
|
+
* Arche v0.3.9
|
|
3
3
|
* https://github.com/richytong/arche
|
|
4
4
|
* (c) 2020-2023 Richard Tong
|
|
5
5
|
* Arche may be freely distributed under the MIT license.
|
|
@@ -31,6 +31,13 @@ const elementSetAttribute = function (element, key, value) {
|
|
|
31
31
|
if (value == null) { // boolean
|
|
32
32
|
element.setAttribute(key, value)
|
|
33
33
|
}
|
|
34
|
+
else if (typeof value == 'boolean') {
|
|
35
|
+
if (value) {
|
|
36
|
+
element.setAttribute(key, key)
|
|
37
|
+
} else {
|
|
38
|
+
element.removeAttribute(key)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
34
41
|
else if (value.constructor == Object) { // style
|
|
35
42
|
for (const subKey in value) {
|
|
36
43
|
element[key][subKey] = value[subKey]
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Arche v0.3.
|
|
2
|
+
* Arche v0.3.9
|
|
3
3
|
* https://github.com/richytong/arche
|
|
4
4
|
* (c) 2020-2023 Richard Tong
|
|
5
5
|
* Arche may be freely distributed under the MIT license.
|
|
@@ -25,6 +25,13 @@ const elementSetAttribute = function (element, key, value) {
|
|
|
25
25
|
if (value == null) { // boolean
|
|
26
26
|
element.setAttribute(key, value)
|
|
27
27
|
}
|
|
28
|
+
else if (typeof value == 'boolean') {
|
|
29
|
+
if (value) {
|
|
30
|
+
element.setAttribute(key, key)
|
|
31
|
+
} else {
|
|
32
|
+
element.removeAttribute(key)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
28
35
|
else if (value.constructor == Object) { // style
|
|
29
36
|
for (const subKey in value) {
|
|
30
37
|
element[key][subKey] = value[subKey]
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -46,6 +46,7 @@ describe('Arche', () => {
|
|
|
46
46
|
Article('yo'),
|
|
47
47
|
]),
|
|
48
48
|
Button({
|
|
49
|
+
disabled: true,
|
|
49
50
|
onClick: listener,
|
|
50
51
|
onMouseOver(event) {
|
|
51
52
|
console.log('onmouseover')
|
|
@@ -62,7 +63,7 @@ describe('Arche', () => {
|
|
|
62
63
|
|
|
63
64
|
assert.strictEqual(
|
|
64
65
|
JSON.stringify(el),
|
|
65
|
-
'{"type":"div","children":[{"type":"h1","children":[{"type":"text","text":"header"}],"style":{}},{"type":"p","children":[{"type":"text","text":"description"}],"style":{"color":"grey"}},{"type":"span","children":[],"style":{},"id":"hey","excluded":null},{"type":"div","children":[{"type":"article","children":[{"type":"text","text":"yo"}],"style":{}}],"style":{},"id":"nested"},{"type":"button","children":[],"style":{}}],"style":{}}')
|
|
66
|
+
'{"type":"div","children":[{"type":"h1","children":[{"type":"text","text":"header"}],"style":{}},{"type":"p","children":[{"type":"text","text":"description"}],"style":{"color":"grey"}},{"type":"span","children":[],"style":{},"id":"hey","excluded":null},{"type":"div","children":[{"type":"article","children":[{"type":"text","text":"yo"}],"style":{}}],"style":{},"id":"nested"},{"type":"button","children":[],"style":{},"disabled":"disabled"}],"style":{}}')
|
|
66
67
|
})
|
|
67
68
|
})
|
|
68
69
|
|