lahama 2.3.0 → 2.4.0
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/dist/lahama.js +21 -22
- package/package.json +1 -1
package/dist/lahama.js
CHANGED
|
@@ -174,14 +174,24 @@ function hFragment(vNodes) {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
function addEventListener
|
|
178
|
-
|
|
179
|
-
|
|
177
|
+
function addEventListener(
|
|
178
|
+
eventName,
|
|
179
|
+
handler,
|
|
180
|
+
el,
|
|
181
|
+
hostComponent = null
|
|
182
|
+
) {
|
|
183
|
+
function boundHandler() {
|
|
184
|
+
hostComponent
|
|
185
|
+
? handler.apply(hostComponent, arguments)
|
|
186
|
+
: handler(...arguments);
|
|
187
|
+
}
|
|
188
|
+
el.addEventListener(eventName, boundHandler);
|
|
189
|
+
return boundHandler
|
|
180
190
|
}
|
|
181
191
|
function addEventListeners(listeners = {}, el) {
|
|
182
192
|
const addedListeners = {};
|
|
183
193
|
Object.entries(listeners).forEach(([eventName, handler]) => {
|
|
184
|
-
addedListeners[eventName] =
|
|
194
|
+
addedListeners[eventName] = addEventListenerCustom(eventName, handler, el);
|
|
185
195
|
});
|
|
186
196
|
return addedListeners
|
|
187
197
|
}
|
|
@@ -409,11 +419,11 @@ function patchDOM(oldVdom, newVdom, parentEl) {
|
|
|
409
419
|
}
|
|
410
420
|
newVdom.el = oldVdom.el;
|
|
411
421
|
switch (newVdom.type) {
|
|
412
|
-
case DOM_TYPES.TEXT
|
|
422
|
+
case DOM_TYPES.TEXT: {
|
|
413
423
|
patchText(oldVdom, newVdom);
|
|
414
424
|
return newVdom
|
|
415
425
|
}
|
|
416
|
-
case DOM_TYPES.ELEMENT
|
|
426
|
+
case DOM_TYPES.ELEMENT: {
|
|
417
427
|
patchElement(oldVdom, newVdom);
|
|
418
428
|
break
|
|
419
429
|
}
|
|
@@ -441,16 +451,16 @@ function findIndexInParent(parentEl, el) {
|
|
|
441
451
|
const {
|
|
442
452
|
class : oldClass,
|
|
443
453
|
style : oldStyle,
|
|
444
|
-
on
|
|
454
|
+
on: oldEvents,
|
|
445
455
|
...oldAttrs
|
|
446
456
|
} = oldVdom.props;
|
|
447
457
|
const {
|
|
448
|
-
class
|
|
449
|
-
style
|
|
450
|
-
on
|
|
458
|
+
class: newClass,
|
|
459
|
+
style: newStyle,
|
|
460
|
+
on: newEvents,
|
|
451
461
|
...newAttrs
|
|
452
462
|
} = newVdom.props;
|
|
453
|
-
const { listeners
|
|
463
|
+
const { listeners: oldListeners } = oldVdom;
|
|
454
464
|
patchAttrs(el, oldAttrs, newAttrs);
|
|
455
465
|
patchClasses(el, oldClass, newClass);
|
|
456
466
|
patchStyles(el, oldStyle, newStyle);
|
|
@@ -492,17 +502,6 @@ function patchStyles(el, oldStyle = {}, newStyle = {}) {
|
|
|
492
502
|
setStyle(el, style, newStyle[style]);
|
|
493
503
|
}
|
|
494
504
|
}
|
|
495
|
-
function addEventListener(eventName, handler, el) {
|
|
496
|
-
function boundHandler(event) {
|
|
497
|
-
handler(event);
|
|
498
|
-
}
|
|
499
|
-
el.addEventListener(eventName, boundHandler);
|
|
500
|
-
//!el.addEventListener("click", boundHandler) {
|
|
501
|
-
//! Element: el
|
|
502
|
-
//! Event: "click"
|
|
503
|
-
//! Listener : boundHandler!}
|
|
504
|
-
return boundHandler
|
|
505
|
-
}
|
|
506
505
|
function patchEvents(
|
|
507
506
|
el,
|
|
508
507
|
oldListeners = {},
|