Skip to content

Commit 8146702

Browse files
format fix
1 parent e0251d6 commit 8146702

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

perf/runner.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
if (params.get("using").includes("morphdom")) {
3434
morphdom(document.body.firstElementChild, end);
3535
} else {
36-
Idiomorph.morph(document.body.firstElementChild, end, { keepInputValues });
36+
Idiomorph.morph(document.body.firstElementChild, end, {
37+
keepInputValues,
38+
});
3739
}
3840
bench.stop();
3941
});

perf/runner.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ if (benchmarks.length === 0) {
1919
}
2020

2121
benchmarks.forEach((benchmark) => {
22-
const keepInputValues = process.env.KEEP_INPUT_VALUES === "true" ? "&keepInputValues=true" : "";
22+
const keepInputValues =
23+
process.env.KEEP_INPUT_VALUES === "true" ? "&keepInputValues=true" : "";
2324
const config = {
2425
root: "..",
2526
benchmarks: [

src/idiomorph.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,14 @@ var Idiomorph = (function () {
689689
if (oldElt.getAttribute(newAttribute.name) !== newAttribute.value) {
690690
oldElt.setAttribute(newAttribute.name, newAttribute.value);
691691
// With keepInputValues, update input.value when value attribute changes
692-
if (ctx.keepInputValues && newAttribute.name === "value" &&
693-
oldElt instanceof HTMLInputElement && newElt instanceof HTMLInputElement &&
694-
newElt.type !== "file" && !ignoreValueOfActiveElement(oldElt, ctx)) {
692+
if (
693+
ctx.keepInputValues &&
694+
newAttribute.name === "value" &&
695+
oldElt instanceof HTMLInputElement &&
696+
newElt instanceof HTMLInputElement &&
697+
newElt.type !== "file" &&
698+
!ignoreValueOfActiveElement(oldElt, ctx)
699+
) {
695700
oldElt.value = newElt.value;
696701
}
697702
}

test/core.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -745,18 +745,18 @@ describe("Core morphing tests", function () {
745745
let parent = make('<div><input value="foo"></div>');
746746
document.body.append(parent);
747747
let initial = parent.querySelector("input");
748-
748+
749749
initial.value = "userTyped";
750-
750+
751751
let finalSrc = '<input value="newServerValue">';
752-
Idiomorph.morph(initial, finalSrc, {
752+
Idiomorph.morph(initial, finalSrc, {
753753
morphStyle: "outerHTML",
754-
keepInputValues: true
754+
keepInputValues: true,
755755
});
756-
756+
757757
initial.value.should.equal("newServerValue");
758758
initial.getAttribute("value").should.equal("newServerValue");
759-
759+
760760
document.body.removeChild(parent);
761761
});
762762
});

0 commit comments

Comments
 (0)