Skip to content

Commit

Permalink
improve naming
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed Mar 2, 2024
1 parent 89e5e1a commit c516492
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
21 changes: 10 additions & 11 deletions dist/morphlex.js

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

10 changes: 4 additions & 6 deletions src/morphlex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,13 @@ class Morph {
}

morph(node: ChildNode, reference: ChildNode): void {
const readonlyReference = reference as ReadonlyNode<ChildNode>;

if (isParentNode(node) && isParentNode(readonlyReference)) {
if (isParentNode(node) && isParentNode(reference)) {
this.#mapIdSets(node);
this.#mapIdSets(readonlyReference);
this.#mapIdSets(reference);
this.#mapSensivity(node);
}

this.#morphNode(node, readonlyReference);
this.#morphNode(node, reference);
}

#mapSensivity(node: ReadonlyNode<ParentNode>): void {
Expand Down Expand Up @@ -238,7 +236,7 @@ class Morph {

for (let i = 0; i < refChildNodes.length; i++) {
const child = childNodes[i] as ChildNode | null;
const refChild = refChildNodes[i]; //as ReadonlyNode<ChildNode> | null;
const refChild = refChildNodes[i] as ReadonlyNode<ChildNode> | null;

if (child && refChild) {
if (isElement(child) && isElement(refChild)) this.#morphChildElement(child, refChild, element);
Expand Down
4 changes: 2 additions & 2 deletions test/morphlex.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("morph", () => {
expect(original.outerHTML).to.equal(reference.outerHTML);
});

it("can stream html", async () => {
it.only("can stream html", async () => {
const iframe = await fixture(`<iframe></iframe>`);

const contentDocument = iframe.contentDocument;
Expand All @@ -38,7 +38,7 @@ describe("morph", () => {

observer.observe(body, { childList: true, subtree: true });

contentDocument.write("<h1>Hello World</h1>");
contentDocument.write("<article><h1>Hello World</h1>");
contentDocument.write("<p>Wh");
contentDocument.write("at's up?</p>");
contentDocument.write("<div><span>Hello</span><span>Another span");
Expand Down

0 comments on commit c516492

Please sign in to comment.