babel-plugin-jsx-dom-expressions 0.34.1 → 0.34.2

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 -3
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -1593,7 +1593,7 @@ function transformElement$2(path, info) {
1593
1593
  t__namespace.callExpression(registerImportMethod(path, "ssrHydrationKey"), [])
1594
1594
  );
1595
1595
  }
1596
- transformAttributes$1(path, results);
1596
+ transformAttributes$1(path, results, { ...config, ...info });
1597
1597
  appendToTemplate(results.template, ">");
1598
1598
  if (!voidTag) {
1599
1599
  transformChildren$1(path, results, { ...config, ...info });
@@ -1761,7 +1761,7 @@ function normalizeAttributes(path) {
1761
1761
  return attributes;
1762
1762
  }
1763
1763
 
1764
- function transformAttributes$1(path, results) {
1764
+ function transformAttributes$1(path, results, info) {
1765
1765
  const tagName = getTagName(path.node),
1766
1766
  isSVG = SVGElements.has(tagName),
1767
1767
  hasChildren = path.node.children.length > 0,
@@ -1798,8 +1798,11 @@ function transformAttributes$1(path, results) {
1798
1798
  )
1799
1799
  return;
1800
1800
  else if (ChildProperties.has(key)) {
1801
- children = value;
1801
+ if (info.hydratable && key === "textContent" && value && value.expression) {
1802
+ value.expression = t__namespace.logicalExpression("||", value.expression, t__namespace.stringLiteral(" "));
1803
+ }
1802
1804
  if (key === "innerHTML") path.doNotEscape = true;
1805
+ children = value;
1803
1806
  } else {
1804
1807
  let doEscape = true;
1805
1808
  if (BooleanAttributes.has(key)) {
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.34.1",
4
+ "version": "0.34.2",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "peerDependencies": {
28
28
  "@babel/core": "^7.0.0"
29
29
  },
30
- "gitHead": "5e49406921a4fde147b9b64edbfa8fc8c096fbda"
30
+ "gitHead": "06b4f8106558dccae5071d4974b876b79e431b00"
31
31
  }