babel-plugin-jsx-dom-expressions 0.36.5 → 0.36.7

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 +95 -42
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -600,26 +600,60 @@ function canNativeSpread(key, { checkNameSpaces } = {}) {
600
600
  return true;
601
601
  }
602
602
 
603
- const alwaysClose = [
604
- "title",
605
- "style",
603
+ const InlineElements = [
606
604
  "a",
607
- "strong",
608
- "small",
605
+ "abbr",
606
+ "acronym",
609
607
  "b",
610
- "u",
611
- "i",
612
- "em",
613
- "s",
614
- "code",
615
- "object",
616
- "table",
608
+ "bdi",
609
+ "bdo",
610
+ "big",
611
+ "br",
617
612
  "button",
618
- "textarea",
619
- "select",
613
+ "canvas",
614
+ "cite",
615
+ "code",
616
+ "data",
617
+ "datalist",
618
+ "del",
619
+ "dfn",
620
+ "em",
621
+ "embed",
622
+ "i",
620
623
  "iframe",
624
+ "img",
625
+ "input",
626
+ "ins",
627
+ "kbd",
628
+ "label",
629
+ "map",
630
+ "mark",
631
+ "meter",
632
+ "noscript",
633
+ "object",
634
+ "output",
635
+ "picture",
636
+ "progress",
637
+ "q",
638
+ "ruby",
639
+ "s",
640
+ "samp",
621
641
  "script",
622
- "template"
642
+ "select",
643
+ "slot",
644
+ "small",
645
+ "span",
646
+ "strong",
647
+ "sub",
648
+ "sup",
649
+ "svg",
650
+ "template",
651
+ "textarea",
652
+ "time",
653
+ "u",
654
+ "tt",
655
+ "var",
656
+ "video"
623
657
  ];
624
658
 
625
659
  const BlockElements = [
@@ -627,9 +661,9 @@ const BlockElements = [
627
661
  "article",
628
662
  "aside",
629
663
  "blockquote",
630
- "canvas",
631
664
  "dd",
632
665
  "details",
666
+ "dialog",
633
667
  "div",
634
668
  "dl",
635
669
  "dt",
@@ -649,17 +683,36 @@ const BlockElements = [
649
683
  "hr",
650
684
  "li",
651
685
  "main",
686
+ "menu",
652
687
  "nav",
653
- "noscript",
654
688
  "ol",
655
- "output",
656
689
  "p",
657
690
  "pre",
658
691
  "section",
659
692
  "table",
660
- "tfoot",
661
- "ul",
662
- "video"
693
+ "ul"
694
+ ];
695
+
696
+ const alwaysClose = [
697
+ "title",
698
+ "style",
699
+ "a",
700
+ "strong",
701
+ "small",
702
+ "b",
703
+ "u",
704
+ "i",
705
+ "em",
706
+ "s",
707
+ "code",
708
+ "object",
709
+ "table",
710
+ "button",
711
+ "textarea",
712
+ "select",
713
+ "iframe",
714
+ "script",
715
+ "template"
663
716
  ];
664
717
 
665
718
  function transformElement$3(path, info) {
@@ -708,12 +761,12 @@ function transformElement$3(path, info) {
708
761
  }
709
762
  results.template += ">";
710
763
  if (!voidTag) {
711
- // always close tags can still be skipped if they have no parents and are the last element
712
- const toBeClosed = !info.lastElement || (info.toBeClosed && info.toBeClosed.includes(tagName));
764
+ // always close tags can still be skipped if they have no closing parents and are the last element
765
+ const toBeClosed = !info.lastElement || (info.toBeClosed && info.toBeClosed.has(tagName));
713
766
  if (toBeClosed) {
714
- results.toBeClosed = info.toBeClosed || [...alwaysClose];
715
- results.toBeClosed.push(tagName);
716
- if (tagName === "a") results.toBeClosed.push(...BlockElements);
767
+ results.toBeClosed = new Set(info.toBeClosed || alwaysClose);
768
+ results.toBeClosed.add(tagName);
769
+ if (InlineElements.includes(tagName)) BlockElements.forEach(i => results.toBeClosed.add(i));
717
770
  }
718
771
  transformChildren$2(path, results, config);
719
772
  if (toBeClosed) results.template += `</${tagName}>`;
@@ -759,23 +812,23 @@ function setAttr$2(path, elem, name, value, { isSVG, dynamic, prevId, isCE, tagN
759
812
  [t__namespace.stringLiteral(name)]
760
813
  );
761
814
  }
762
- return t__namespace.conditionalExpression(t__namespace.binaryExpression(
763
- "!=",
764
- value,
765
- t__namespace.nullLiteral()
766
- ), t__namespace.callExpression(
767
- t__namespace.memberExpression(
768
- t__namespace.memberExpression(elem, t__namespace.identifier("style")),
769
- t__namespace.identifier("setProperty")
770
- ),
771
- [t__namespace.stringLiteral(name), prevId ? prevId : value]
772
- ), t__namespace.callExpression(
773
- t__namespace.memberExpression(
774
- t__namespace.memberExpression(elem, t__namespace.identifier("style")),
775
- t__namespace.identifier("removeProperty")
815
+ return t__namespace.conditionalExpression(
816
+ t__namespace.binaryExpression("!=", value, t__namespace.nullLiteral()),
817
+ t__namespace.callExpression(
818
+ t__namespace.memberExpression(
819
+ t__namespace.memberExpression(elem, t__namespace.identifier("style")),
820
+ t__namespace.identifier("setProperty")
821
+ ),
822
+ [t__namespace.stringLiteral(name), prevId ? prevId : value]
776
823
  ),
777
- [t__namespace.stringLiteral(name)]
778
- ));
824
+ t__namespace.callExpression(
825
+ t__namespace.memberExpression(
826
+ t__namespace.memberExpression(elem, t__namespace.identifier("style")),
827
+ t__namespace.identifier("removeProperty")
828
+ ),
829
+ [t__namespace.stringLiteral(name)]
830
+ )
831
+ );
779
832
  }
780
833
 
781
834
  if (namespace === "class") {
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.36.5",
4
+ "version": "0.36.7",
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": "d0146a831acf798245be5f3e459a83a10cb2a3dc"
34
+ "gitHead": "cde236af9c2dfc9ab4642c08decf06fc90172e5f"
35
35
  }