@server/next 0.44.0 → 0.45.0

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.
@@ -21,8 +21,6 @@ const SVG_TAGS = new Set([
21
21
  "defs",
22
22
  ]);
23
23
 
24
- const REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
25
-
26
24
  const ALT_NAMES = {
27
25
  classname: "class",
28
26
  htmlfor: "for",
@@ -100,8 +98,9 @@ const renderChild = (child) => {
100
98
  };
101
99
 
102
100
  const jsx = (tag, { children, ...props } = {}) => {
103
- // Fragment (Symbol-safe)
104
- if (tag === REACT_FRAGMENT_TYPE || tag === Fragment) {
101
+ // Fragment. It is the registered React symbol, so a compiled React library
102
+ // matches whether it imports Fragment or inlines Symbol.for("react.fragment")
103
+ if (tag === Fragment) {
105
104
  return () => renderChild(children);
106
105
  }
107
106
 
@@ -158,7 +157,9 @@ const jsx = (tag, { children, ...props } = {}) => {
158
157
  // `minify` drives <style>, it isn't an HTML attribute
159
158
  .filter(([k]) => !(tag === "style" && k === "minify"))
160
159
  .filter(([k, v]) => !/on[A-Z]/.test(k) && typeof v !== "function")
161
- .filter(([, v]) => v !== false)
160
+ // `false`, `null` and `undefined` drop the attribute (as React does),
161
+ // rather than rendering it empty
162
+ .filter(([, v]) => v !== false && v != null)
162
163
  .map(([k, v]) => {
163
164
  const preserveSvg = k === "viewBox" || k === "preserveAspectRatio";
164
165
 
@@ -180,6 +181,7 @@ const jsx = (tag, { children, ...props } = {}) => {
180
181
  return `${cssKey}:${val}`;
181
182
  })
182
183
  .join(";");
184
+ if (!v) return null; // an empty style object adds nothing
183
185
  }
184
186
 
185
187
  const value =
@@ -187,6 +189,7 @@ const jsx = (tag, { children, ...props } = {}) => {
187
189
 
188
190
  return `${key}="${value}"`;
189
191
  })
192
+ .filter((attr) => attr !== null)
190
193
  .join(" ");
191
194
 
192
195
  if (attrStr) attrStr = ` ${attrStr}`;