babel-plugin-jsx-dom-expressions 0.37.2 → 0.37.8

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.
Files changed (2) hide show
  1. package/index.js +6 -4
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -2290,7 +2290,7 @@ function transformAttributes$1(path, results, info) {
2290
2290
  t__namespace.isJSXExpressionContainer(value) &&
2291
2291
  (reservedNameSpace ||
2292
2292
  ChildProperties.has(key) ||
2293
- !(t__namespace.isStringLiteral(value.expression) || t__namespace.isNumericLiteral(value.expression)))
2293
+ !(t__namespace.isStringLiteral(value.expression) || t__namespace.isNumericLiteral(value.expression) || t__namespace.isBooleanLiteral(value.expression)))
2294
2294
  ) {
2295
2295
  if (
2296
2296
  key === "ref" ||
@@ -2366,7 +2366,7 @@ function transformAttributes$1(path, results, info) {
2366
2366
  }
2367
2367
  if (doEscape) value.expression = escapeExpression(path, value.expression, true);
2368
2368
 
2369
- if (!doEscape || t__namespace.isLiteral(value.expression) || t__namespace.isBinaryExpression(value.expression)) {
2369
+ if (!doEscape || t__namespace.isLiteral(value.expression)) {
2370
2370
  key = toAttribute(key, isSVG);
2371
2371
  appendToTemplate(results.template, ` ${key}="`);
2372
2372
  results.template.push(`"`);
@@ -2377,9 +2377,11 @@ function transformAttributes$1(path, results, info) {
2377
2377
  if (key === "$ServerOnly") return;
2378
2378
  if (t__namespace.isJSXExpressionContainer(value)) value = value.expression;
2379
2379
  key = toAttribute(key, isSVG);
2380
+ const isBoolean = BooleanAttributes.has(key);
2381
+ if (isBoolean && value && value.value !== "" && !value.value) return;
2380
2382
  appendToTemplate(results.template, ` ${key}`);
2381
2383
  if (!value) return;
2382
- let text = value.value;
2384
+ let text = isBoolean ? "" : value.value;
2383
2385
  if (key === "style" || key === "class") {
2384
2386
  text = trimWhitespace(text);
2385
2387
  if (key === "style") {
@@ -2903,7 +2905,7 @@ function processSpreads(path, attributes, { elem, hasChildren, wrapConditionals
2903
2905
  (firstSpread ||
2904
2906
  (t__namespace.isJSXExpressionContainer(node.value) &&
2905
2907
  isDynamic(attribute.get("value").get("expression"), { checkMember: true }))) &&
2906
- canNativeSpread(key)
2908
+ canNativeSpread(key, { checkNameSpaces: true })
2907
2909
  ) {
2908
2910
  const isContainer = t__namespace.isJSXExpressionContainer(node.value);
2909
2911
  const dynamic =
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "babel-plugin-jsx-dom-expressions",
3
3
  "description": "A JSX to DOM plugin that wraps expressions for fine grained change detection",
4
- "version": "0.37.2",
4
+ "version": "0.37.8",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -31,5 +31,5 @@
31
31
  "devDependencies": {
32
32
  "@babel/core": "^7.20.12"
33
33
  },
34
- "gitHead": "6f5b3cb774365b9ef4334d2d1c2ff5d6ac34f03d"
34
+ "gitHead": "51b297d6ed45d1a3dbbe7a45f2f58b8b524427ab"
35
35
  }