Skip to content

Commit

Permalink
refactor: Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Masquerade-Circus committed Nov 8, 2023
1 parent 2224a99 commit 070ddc7
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 49 deletions.
4 changes: 4 additions & 0 deletions dist/index.d.ts
@@ -1,5 +1,9 @@
declare global {
var document: Document;
namespace JSX {
interface IntrinsicElements extends DefaultRecord {
}
}
}
interface DefaultRecord extends Record<string | number | symbol, any> {
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 5 additions & 12 deletions dist/index.js
Expand Up @@ -87,10 +87,7 @@ function domToVnode(dom) {
const attr = attributes[i];
props[attr.nodeName] = attr.nodeValue;
}
const vnode = new Vnode(tag, props, children);
vnode.dom = dom;
vnode.isSVG = tag === "svg";
return vnode;
return new Vnode(tag, props, children, dom, tag === "svg");
}
}
function trust(htmlString) {
Expand Down Expand Up @@ -541,11 +538,11 @@ function patch(newVnode) {
for (let i = 0; i < childrenLength; i++) {
const oldChild = oldDomChildren[i];
const newChild = children[i];
if (!oldChild) {
createNewElement(newChild, newVnode, null);
continue;
}
if (newChild instanceof Vnode === false) {
if (!oldChild) {
newVnode.dom.appendChild(document.createTextNode(newChild));
continue;
}
if (oldChild.nodeType !== 3) {
newVnode.dom.replaceChild(document.createTextNode(newChild), oldChild);
continue;
Expand All @@ -555,10 +552,6 @@ function patch(newVnode) {
}
continue;
}
if (!oldChild) {
createNewElement(newChild, newVnode, null);
continue;
}
if ("v-keep" in newChild.props) {
if (oldChild.props && oldChild.props["v-keep"] === newChild.props["v-keep"]) {
continue;
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js.map

Large diffs are not rendered by default.

0 comments on commit 070ddc7

Please sign in to comment.