Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/aidenybai/million into main
Browse files Browse the repository at this point in the history
  • Loading branch information
aidenybai committed Jun 13, 2021
2 parents fa27a9b + 6883715 commit 9aacecf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/m.ts
Expand Up @@ -20,6 +20,7 @@ export enum VFlags {
* @param {VElement} vnode - SVG VNode
* @returns {VElement}
*/
/* istanbul ignore next */
export const svg = (vnode: VElement): VElement => {
if (!vnode.props) vnode.props = {};
ns(vnode.tag, vnode.props, vnode.children);
Expand Down
3 changes: 3 additions & 0 deletions src/patch.ts
Expand Up @@ -8,6 +8,7 @@ import { VElement, VNode, VProps, VFlags } from './m';
* @param {VProps} oldProps - Old VNode props
* @param {VProps} newProps - New VNode props
*/
/* istanbul ignore next */
export const patchProps = (el: HTMLElement, oldProps: VProps = {}, newProps: VProps = {}): void => {
if (!oldProps && !newProps) return;

Expand Down Expand Up @@ -51,11 +52,13 @@ export const patchChildren = (
newVNodeChildren: VNode[],
): void => {
const childNodes = [...el.childNodes];
/* istanbul ignore next */
if (oldVNodeChildren) {
for (let i = 0; i < oldVNodeChildren.length; ++i) {
patch(<HTMLElement | Text>childNodes[i], newVNodeChildren[i], oldVNodeChildren[i]);
}
}
/* istanbul ignore next */
const slicedNewVNodeChildren = newVNodeChildren.slice(oldVNodeChildren?.length ?? 0);
for (let i = 0; i < slicedNewVNodeChildren.length; ++i) {
el.appendChild(createElement(slicedNewVNodeChildren[i], false));
Expand Down

0 comments on commit 9aacecf

Please sign in to comment.