dom-expressions 0.40.8 → 0.40.10
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/package.json +3 -3
- package/src/client.js +14 -1
- package/src/server.js +10 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dom-expressions",
|
|
3
3
|
"description": "A Fine-Grained Runtime for Performant DOM Rendering",
|
|
4
|
-
"version": "0.40.
|
|
4
|
+
"version": "0.40.10",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"seroval-plugins": "~1.5.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"babel-plugin-jsx-dom-expressions": "^0.40.
|
|
27
|
+
"babel-plugin-jsx-dom-expressions": "^0.40.10",
|
|
28
28
|
"csstype": "^3.1",
|
|
29
29
|
"seroval": "~1.5.0",
|
|
30
30
|
"seroval-plugins": "~1.5.0"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "727298ff79a54ef5299d3649ab7f4105a326e9b3"
|
|
33
33
|
}
|
package/src/client.js
CHANGED
|
@@ -107,7 +107,14 @@ export function clearDelegatedEvents(document = window.document) {
|
|
|
107
107
|
|
|
108
108
|
export function setProperty(node, name, value) {
|
|
109
109
|
if (isHydrating(node)) return;
|
|
110
|
-
|
|
110
|
+
// Compiler on next emits `el.value = v ?? ""` for input/textarea. 0.40.x
|
|
111
|
+
// still goes through setProperty, so apply the same rule here (#2957).
|
|
112
|
+
if (
|
|
113
|
+
(name === "value" || name === "defaultValue") &&
|
|
114
|
+
(node.nodeName === "INPUT" || node.nodeName === "TEXTAREA")
|
|
115
|
+
)
|
|
116
|
+
node[name] = value ?? "";
|
|
117
|
+
else node[name] = value;
|
|
111
118
|
}
|
|
112
119
|
|
|
113
120
|
export function setAttribute(node, name, value) {
|
|
@@ -384,6 +391,12 @@ function assignProp(node, prop, value, prev, isSVG, skipRef, props) {
|
|
|
384
391
|
} else if (isHydrating(node)) return value;
|
|
385
392
|
if (prop === "class" || prop === "className") className(node, value);
|
|
386
393
|
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
394
|
+
else if (
|
|
395
|
+
(prop === "value" || prop === "defaultValue") &&
|
|
396
|
+
(node.nodeName === "INPUT" || node.nodeName === "TEXTAREA")
|
|
397
|
+
)
|
|
398
|
+
// Spread path assigned raw, so value={undefined} painted "undefined" (#2957).
|
|
399
|
+
node[propAlias || prop] = value ?? "";
|
|
387
400
|
else node[propAlias || prop] = value;
|
|
388
401
|
} else {
|
|
389
402
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
package/src/server.js
CHANGED
|
@@ -432,7 +432,16 @@ export function escape(s, attr) {
|
|
|
432
432
|
for (let i = 0; i < s.length; i++) s[i] = escape(s[i]);
|
|
433
433
|
return s;
|
|
434
434
|
}
|
|
435
|
-
if (attr
|
|
435
|
+
if (attr) {
|
|
436
|
+
if (t === "boolean") return String(s);
|
|
437
|
+
// Nullish values pass through so callers can omit the attribute, and
|
|
438
|
+
// numbers can never contain `&` or `"`. Everything else (arrays,
|
|
439
|
+
// objects) would be stringified by the surrounding template literal
|
|
440
|
+
// anyway, so coerce to the final string here first — matching what the
|
|
441
|
+
// client DOM receives — and run it through the normal string path.
|
|
442
|
+
if (s == null || t === "number") return s;
|
|
443
|
+
return escape(String(s), attr);
|
|
444
|
+
}
|
|
436
445
|
return s;
|
|
437
446
|
}
|
|
438
447
|
const delim = attr ? '"' : "<";
|