Skip to content

Commit ebd19ad

Browse files
committed
Reducing size by another byte
1 parent c023664 commit ebd19ad

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

src/dotdom.js

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ module.exports = window;
2929

3030
((window) => {
3131

32+
/**
33+
* Helper method that calls all methods in an array of functions
34+
*
35+
* @param {Array} methods - The array of methods to call
36+
* @param {Object} arg1 - An arbitrary first argument
37+
* @param {Object} arg2 - An arbitrary second argument
38+
*/
39+
let callLifecycleMethods = (methods = [], arg1) =>
40+
methods.map(e => e(arg1)) // Fan-out to the lifecycle methods
41+
3242
/**
3343
* Helper for creating new Virtual DOM element
3444
*
@@ -54,18 +64,6 @@ module.exports = window;
5464
}
5565
)
5666

57-
58-
/**
59-
* Helper method that calls all methods in an array of functions
60-
*
61-
* @param {Array} methods - The array of methods to call
62-
* @param {Object} arg1 - An arbitrary first argument
63-
* @param {Object} arg2 - An arbitrary second argument
64-
*/
65-
let callLifecycleMethods = (methods = [], arg1) =>
66-
methods.map(e => e(arg1)) // Fan-out to the lifecycle methods
67-
68-
6967
/**
7068
* Helper function that wraps an element shorthand function with a proxy
7169
* that can be used to append class names to the instance.
@@ -153,19 +151,16 @@ module.exports = window;
153151
updateDom = (node, vnode, hooks) => (
154152
vnode.$
155153
? Object.keys(vnode.a).map( // - Element nodes have properties
156-
(
157-
key // 1. The property name
158-
) =>
159-
154+
(key) => // 1. The property name
160155
key == "style" ? // The "style" property is an object and must be
161156
// applied recursively.
162157
Object.assign(
163158
node[key], // "[key]" is shorter than ".style"
164159
vnode.a[key]
165160
)
166161

167-
: (node[key] != vnode.a[key] && // All properties are applied directly to DOM, as
168-
(node[key] = vnode.a[key])) // long as they are different than ther value in the
162+
: (node[key] == vnode.a[key] // All properties are applied directly to DOM, as
163+
? node : (node[key] = vnode.a[key])) // long as they are different than ther value in the
169164
// instance. This includes `onXXX` event handlers.
170165

171166
) &&
@@ -181,8 +176,8 @@ module.exports = window;
181176
vnode.a.c, // we recursively continue rendering into it"s
182177
node // child nodes.
183178
))
184-
: (node.data != vnode) && // - String nodes update only the text content is changed
185-
(node.data = vnode),
179+
: (node.data == vnode) // - String nodes update only the text content is changed
180+
? node : (node.data = vnode),
186181
Object.assign(node, hooks),
187182
_new_cache[hooks.k] = node
188183
),

0 commit comments

Comments
 (0)