html-react-parser 4.2.8 → 4.2.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.
@@ -756,6 +756,7 @@
756
756
  */
757
757
  parseFromString = function (html, tagName) {
758
758
  if (tagName) {
759
+ /* istanbul ignore next */
759
760
  html = "<".concat(tagName, ">").concat(html, "</").concat(tagName, ">");
760
761
  }
761
762
  return domParser_1.parseFromString(html, mimeType_1);
@@ -962,7 +963,7 @@
962
963
  */
963
964
  function formatDOM(nodes, parent, directive) {
964
965
  if (parent === void 0) { parent = null; }
965
- var result = [];
966
+ var domNodes = [];
966
967
  var current;
967
968
  var index = 0;
968
969
  var nodesLength = nodes.length;
@@ -991,7 +992,7 @@
991
992
  continue;
992
993
  }
993
994
  // set previous node next
994
- var prev = result[index - 1] || null;
995
+ var prev = domNodes[index - 1] || null;
995
996
  if (prev) {
996
997
  prev.next = current;
997
998
  }
@@ -999,18 +1000,18 @@
999
1000
  current.parent = parent;
1000
1001
  current.prev = prev;
1001
1002
  current.next = null;
1002
- result.push(current);
1003
+ domNodes.push(current);
1003
1004
  }
1004
1005
  if (directive) {
1005
1006
  current = new domhandler_1.ProcessingInstruction(directive.substring(0, directive.indexOf(' ')).toLowerCase(), directive);
1006
- current.next = result[0] || null;
1007
+ current.next = domNodes[0] || null;
1007
1008
  current.parent = parent;
1008
- result.unshift(current);
1009
- if (result[1]) {
1010
- result[1].prev = result[0];
1009
+ domNodes.unshift(current);
1010
+ if (domNodes[1]) {
1011
+ domNodes[1].prev = domNodes[0];
1011
1012
  }
1012
1013
  }
1013
- return result;
1014
+ return domNodes;
1014
1015
  }
1015
1016
  utilities$4.formatDOM = formatDOM;
1016
1017
 
@@ -1031,7 +1032,7 @@
1031
1032
  if (typeof html !== 'string') {
1032
1033
  throw new TypeError('First argument must be a string');
1033
1034
  }
1034
- if (html === '') {
1035
+ if (!html) {
1035
1036
  return [];
1036
1037
  }
1037
1038
  // match directive
@@ -1539,99 +1540,68 @@
1539
1540
  zoomAndPan: 1
1540
1541
  };
1541
1542
 
1542
- Object.defineProperty(lib, '__esModule', { value: true });
1543
-
1544
- function _slicedToArray(arr, i) {
1545
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
1546
- }
1547
-
1548
- function _arrayWithHoles(arr) {
1549
- if (Array.isArray(arr)) return arr;
1550
- }
1551
-
1552
- function _iterableToArrayLimit(arr, i) {
1553
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1554
-
1555
- if (_i == null) return;
1556
- var _arr = [];
1557
- var _n = true;
1558
- var _d = false;
1559
-
1560
- var _s, _e;
1561
-
1562
- try {
1563
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
1564
- _arr.push(_s.value);
1565
-
1566
- if (i && _arr.length === i) break;
1567
- }
1568
- } catch (err) {
1569
- _d = true;
1570
- _e = err;
1571
- } finally {
1572
- try {
1573
- if (!_n && _i["return"] != null) _i["return"]();
1574
- } finally {
1575
- if (_d) throw _e;
1576
- }
1577
- }
1578
-
1579
- return _arr;
1580
- }
1581
-
1582
- function _unsupportedIterableToArray(o, minLen) {
1583
- if (!o) return;
1584
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
1585
- var n = Object.prototype.toString.call(o).slice(8, -1);
1586
- if (n === "Object" && o.constructor) n = o.constructor.name;
1587
- if (n === "Map" || n === "Set") return Array.from(o);
1588
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
1589
- }
1590
-
1591
- function _arrayLikeToArray(arr, len) {
1592
- if (len == null || len > arr.length) len = arr.length;
1543
+ /**
1544
+ * Copyright (c) Facebook, Inc. and its affiliates.
1545
+ *
1546
+ * This source code is licensed under the MIT license found in the
1547
+ * LICENSE file in the root directory of this source tree.
1548
+ *
1549
+ *
1550
+ */
1593
1551
 
1594
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
1595
1552
 
1596
- return arr2;
1597
- }
1598
1553
 
1599
- function _nonIterableRest() {
1600
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1601
- }
1602
1554
 
1603
1555
  // A reserved attribute.
1604
1556
  // It is handled by React separately and shouldn't be written to the DOM.
1605
- var RESERVED = 0; // A simple string attribute.
1557
+ const RESERVED = 0;
1558
+
1559
+ // A simple string attribute.
1606
1560
  // Attributes that aren't in the filter are presumed to have this type.
1561
+ const STRING = 1;
1607
1562
 
1608
- var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
1563
+ // A string attribute that accepts booleans in React. In HTML, these are called
1609
1564
  // "enumerated" attributes with "true" and "false" as possible values.
1610
1565
  // When true, it should be set to a "true" string.
1611
1566
  // When false, it should be set to a "false" string.
1567
+ const BOOLEANISH_STRING = 2;
1612
1568
 
1613
- var BOOLEANISH_STRING = 2; // A real boolean attribute.
1569
+ // A real boolean attribute.
1614
1570
  // When true, it should be present (set either to an empty string or its name).
1615
1571
  // When false, it should be omitted.
1572
+ const BOOLEAN = 3;
1616
1573
 
1617
- var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
1574
+ // An attribute that can be used as a flag as well as with a value.
1618
1575
  // When true, it should be present (set either to an empty string or its name).
1619
1576
  // When false, it should be omitted.
1620
1577
  // For any other value, should be present with that value.
1578
+ const OVERLOADED_BOOLEAN = 4;
1621
1579
 
1622
- var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
1580
+ // An attribute that must be numeric or parse as a numeric.
1623
1581
  // When falsy, it should be removed.
1582
+ const NUMERIC = 5;
1624
1583
 
1625
- var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
1584
+ // An attribute that must be positive numeric or parse as a positive numeric.
1626
1585
  // When falsy, it should be removed.
1586
+ const POSITIVE_NUMERIC = 6;
1627
1587
 
1628
- var POSITIVE_NUMERIC = 6;
1629
1588
  function getPropertyInfo(name) {
1630
1589
  return properties.hasOwnProperty(name) ? properties[name] : null;
1631
1590
  }
1632
1591
 
1633
- function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL, removeEmptyString) {
1634
- this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
1592
+ function PropertyInfoRecord(
1593
+ name,
1594
+ type,
1595
+ mustUseProperty,
1596
+ attributeName,
1597
+ attributeNamespace,
1598
+ sanitizeURL,
1599
+ removeEmptyString,
1600
+ ) {
1601
+ this.acceptsBooleans =
1602
+ type === BOOLEANISH_STRING ||
1603
+ type === BOOLEAN ||
1604
+ type === OVERLOADED_BOOLEAN;
1635
1605
  this.attributeName = attributeName;
1636
1606
  this.attributeNamespace = attributeNamespace;
1637
1607
  this.mustUseProperty = mustUseProperty;
@@ -1639,200 +1609,435 @@
1639
1609
  this.type = type;
1640
1610
  this.sanitizeURL = sanitizeURL;
1641
1611
  this.removeEmptyString = removeEmptyString;
1642
- } // When adding attributes to this list, be sure to also add them to
1612
+ }
1613
+
1614
+ // When adding attributes to this list, be sure to also add them to
1643
1615
  // the `possibleStandardNames` module to ensure casing and incorrect
1644
1616
  // name warnings.
1617
+ const properties = {};
1618
+
1619
+ // These props are reserved by React. They shouldn't be written to the DOM.
1620
+ const reservedProps = [
1621
+ 'children',
1622
+ 'dangerouslySetInnerHTML',
1623
+ // TODO: This prevents the assignment of defaultValue to regular
1624
+ // elements (not just inputs). Now that ReactDOMInput assigns to the
1625
+ // defaultValue property -- do we need this?
1626
+ 'defaultValue',
1627
+ 'defaultChecked',
1628
+ 'innerHTML',
1629
+ 'suppressContentEditableWarning',
1630
+ 'suppressHydrationWarning',
1631
+ 'style',
1632
+ ];
1633
+
1634
+ reservedProps.forEach(name => {
1635
+ properties[name] = new PropertyInfoRecord(
1636
+ name,
1637
+ RESERVED,
1638
+ false, // mustUseProperty
1639
+ name, // attributeName
1640
+ null, // attributeNamespace
1641
+ false, // sanitizeURL
1642
+ false, // removeEmptyString
1643
+ );
1644
+ });
1645
1645
 
1646
-
1647
- var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
1648
-
1649
- var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
1650
- // elements (not just inputs). Now that ReactDOMInput assigns to the
1651
- // defaultValue property -- do we need this?
1652
- 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'];
1653
- reservedProps.forEach(function (name) {
1654
- properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
1655
- name, // attributeName
1656
- null, // attributeNamespace
1657
- false, // sanitizeURL
1658
- false);
1659
- }); // A few React string attributes have a different name.
1646
+ // A few React string attributes have a different name.
1660
1647
  // This is a mapping from React prop names to the attribute names.
1648
+ [
1649
+ ['acceptCharset', 'accept-charset'],
1650
+ ['className', 'class'],
1651
+ ['htmlFor', 'for'],
1652
+ ['httpEquiv', 'http-equiv'],
1653
+ ].forEach(([name, attributeName]) => {
1654
+ properties[name] = new PropertyInfoRecord(
1655
+ name,
1656
+ STRING,
1657
+ false, // mustUseProperty
1658
+ attributeName, // attributeName
1659
+ null, // attributeNamespace
1660
+ false, // sanitizeURL
1661
+ false, // removeEmptyString
1662
+ );
1663
+ });
1661
1664
 
1662
- [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
1663
- var _ref2 = _slicedToArray(_ref, 2),
1664
- name = _ref2[0],
1665
- attributeName = _ref2[1];
1666
-
1667
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
1668
- attributeName, // attributeName
1669
- null, // attributeNamespace
1670
- false, // sanitizeURL
1671
- false);
1672
- }); // These are "enumerated" HTML attributes that accept "true" and "false".
1665
+ // These are "enumerated" HTML attributes that accept "true" and "false".
1673
1666
  // In React, we let users pass `true` and `false` even though technically
1674
1667
  // these aren't boolean attributes (they are coerced to strings).
1668
+ ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(name => {
1669
+ properties[name] = new PropertyInfoRecord(
1670
+ name,
1671
+ BOOLEANISH_STRING,
1672
+ false, // mustUseProperty
1673
+ name.toLowerCase(), // attributeName
1674
+ null, // attributeNamespace
1675
+ false, // sanitizeURL
1676
+ false, // removeEmptyString
1677
+ );
1678
+ });
1675
1679
 
1676
- ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
1677
- properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
1678
- name.toLowerCase(), // attributeName
1679
- null, // attributeNamespace
1680
- false, // sanitizeURL
1681
- false);
1682
- }); // These are "enumerated" SVG attributes that accept "true" and "false".
1680
+ // These are "enumerated" SVG attributes that accept "true" and "false".
1683
1681
  // In React, we let users pass `true` and `false` even though technically
1684
1682
  // these aren't boolean attributes (they are coerced to strings).
1685
1683
  // Since these are SVG attributes, their attribute names are case-sensitive.
1684
+ [
1685
+ 'autoReverse',
1686
+ 'externalResourcesRequired',
1687
+ 'focusable',
1688
+ 'preserveAlpha',
1689
+ ].forEach(name => {
1690
+ properties[name] = new PropertyInfoRecord(
1691
+ name,
1692
+ BOOLEANISH_STRING,
1693
+ false, // mustUseProperty
1694
+ name, // attributeName
1695
+ null, // attributeNamespace
1696
+ false, // sanitizeURL
1697
+ false, // removeEmptyString
1698
+ );
1699
+ });
1686
1700
 
1687
- ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
1688
- properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
1689
- name, // attributeName
1690
- null, // attributeNamespace
1691
- false, // sanitizeURL
1692
- false);
1693
- }); // These are HTML boolean attributes.
1694
-
1695
- ['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
1696
- // on the client side because the browsers are inconsistent. Instead we call focus().
1697
- 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'disableRemotePlayback', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
1698
- 'itemScope'].forEach(function (name) {
1699
- properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
1700
- name.toLowerCase(), // attributeName
1701
- null, // attributeNamespace
1702
- false, // sanitizeURL
1703
- false);
1704
- }); // These are the few React props that we set as DOM properties
1701
+ // These are HTML boolean attributes.
1702
+ [
1703
+ 'allowFullScreen',
1704
+ 'async',
1705
+ // Note: there is a special case that prevents it from being written to the DOM
1706
+ // on the client side because the browsers are inconsistent. Instead we call focus().
1707
+ 'autoFocus',
1708
+ 'autoPlay',
1709
+ 'controls',
1710
+ 'default',
1711
+ 'defer',
1712
+ 'disabled',
1713
+ 'disablePictureInPicture',
1714
+ 'disableRemotePlayback',
1715
+ 'formNoValidate',
1716
+ 'hidden',
1717
+ 'loop',
1718
+ 'noModule',
1719
+ 'noValidate',
1720
+ 'open',
1721
+ 'playsInline',
1722
+ 'readOnly',
1723
+ 'required',
1724
+ 'reversed',
1725
+ 'scoped',
1726
+ 'seamless',
1727
+ // Microdata
1728
+ 'itemScope',
1729
+ ].forEach(name => {
1730
+ properties[name] = new PropertyInfoRecord(
1731
+ name,
1732
+ BOOLEAN,
1733
+ false, // mustUseProperty
1734
+ name.toLowerCase(), // attributeName
1735
+ null, // attributeNamespace
1736
+ false, // sanitizeURL
1737
+ false, // removeEmptyString
1738
+ );
1739
+ });
1740
+
1741
+ // These are the few React props that we set as DOM properties
1705
1742
  // rather than attributes. These are all booleans.
1743
+ [
1744
+ 'checked',
1745
+ // Note: `option.selected` is not updated if `select.multiple` is
1746
+ // disabled with `removeAttribute`. We have special logic for handling this.
1747
+ 'multiple',
1748
+ 'muted',
1749
+ 'selected',
1750
+
1751
+ // NOTE: if you add a camelCased prop to this list,
1752
+ // you'll need to set attributeName to name.toLowerCase()
1753
+ // instead in the assignment below.
1754
+ ].forEach(name => {
1755
+ properties[name] = new PropertyInfoRecord(
1756
+ name,
1757
+ BOOLEAN,
1758
+ true, // mustUseProperty
1759
+ name, // attributeName
1760
+ null, // attributeNamespace
1761
+ false, // sanitizeURL
1762
+ false, // removeEmptyString
1763
+ );
1764
+ });
1706
1765
 
1707
- ['checked', // Note: `option.selected` is not updated if `select.multiple` is
1708
- // disabled with `removeAttribute`. We have special logic for handling this.
1709
- 'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list,
1710
- // you'll need to set attributeName to name.toLowerCase()
1711
- // instead in the assignment below.
1712
- ].forEach(function (name) {
1713
- properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
1714
- name, // attributeName
1715
- null, // attributeNamespace
1716
- false, // sanitizeURL
1717
- false);
1718
- }); // These are HTML attributes that are "overloaded booleans": they behave like
1766
+ // These are HTML attributes that are "overloaded booleans": they behave like
1719
1767
  // booleans, but can also accept a string value.
1768
+ [
1769
+ 'capture',
1770
+ 'download',
1771
+
1772
+ // NOTE: if you add a camelCased prop to this list,
1773
+ // you'll need to set attributeName to name.toLowerCase()
1774
+ // instead in the assignment below.
1775
+ ].forEach(name => {
1776
+ properties[name] = new PropertyInfoRecord(
1777
+ name,
1778
+ OVERLOADED_BOOLEAN,
1779
+ false, // mustUseProperty
1780
+ name, // attributeName
1781
+ null, // attributeNamespace
1782
+ false, // sanitizeURL
1783
+ false, // removeEmptyString
1784
+ );
1785
+ });
1720
1786
 
1721
- ['capture', 'download' // NOTE: if you add a camelCased prop to this list,
1722
- // you'll need to set attributeName to name.toLowerCase()
1723
- // instead in the assignment below.
1724
- ].forEach(function (name) {
1725
- properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
1726
- name, // attributeName
1727
- null, // attributeNamespace
1728
- false, // sanitizeURL
1729
- false);
1730
- }); // These are HTML attributes that must be positive numbers.
1731
-
1732
- ['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list,
1733
- // you'll need to set attributeName to name.toLowerCase()
1734
- // instead in the assignment below.
1735
- ].forEach(function (name) {
1736
- properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
1737
- name, // attributeName
1738
- null, // attributeNamespace
1739
- false, // sanitizeURL
1740
- false);
1741
- }); // These are HTML attributes that must be numbers.
1742
-
1743
- ['rowSpan', 'start'].forEach(function (name) {
1744
- properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
1745
- name.toLowerCase(), // attributeName
1746
- null, // attributeNamespace
1747
- false, // sanitizeURL
1748
- false);
1787
+ // These are HTML attributes that must be positive numbers.
1788
+ [
1789
+ 'cols',
1790
+ 'rows',
1791
+ 'size',
1792
+ 'span',
1793
+
1794
+ // NOTE: if you add a camelCased prop to this list,
1795
+ // you'll need to set attributeName to name.toLowerCase()
1796
+ // instead in the assignment below.
1797
+ ].forEach(name => {
1798
+ properties[name] = new PropertyInfoRecord(
1799
+ name,
1800
+ POSITIVE_NUMERIC,
1801
+ false, // mustUseProperty
1802
+ name, // attributeName
1803
+ null, // attributeNamespace
1804
+ false, // sanitizeURL
1805
+ false, // removeEmptyString
1806
+ );
1749
1807
  });
1750
- var CAMELIZE = /[\-\:]([a-z])/g;
1751
1808
 
1752
- var capitalize$1 = function capitalize(token) {
1753
- return token[1].toUpperCase();
1754
- }; // This is a list of all SVG attributes that need special casing, namespacing,
1809
+ // These are HTML attributes that must be numbers.
1810
+ ['rowSpan', 'start'].forEach(name => {
1811
+ properties[name] = new PropertyInfoRecord(
1812
+ name,
1813
+ NUMERIC,
1814
+ false, // mustUseProperty
1815
+ name.toLowerCase(), // attributeName
1816
+ null, // attributeNamespace
1817
+ false, // sanitizeURL
1818
+ false, // removeEmptyString
1819
+ );
1820
+ });
1821
+
1822
+ const CAMELIZE = /[\-\:]([a-z])/g;
1823
+ const capitalize$1 = token => token[1].toUpperCase();
1824
+
1825
+ // This is a list of all SVG attributes that need special casing, namespacing,
1755
1826
  // or boolean value assignment. Regular attributes that just accept strings
1756
1827
  // and have the same names are omitted, just like in the HTML attribute filter.
1757
1828
  // Some of these attributes can be hard to find. This list was created by
1758
1829
  // scraping the MDN documentation.
1830
+ [
1831
+ 'accent-height',
1832
+ 'alignment-baseline',
1833
+ 'arabic-form',
1834
+ 'baseline-shift',
1835
+ 'cap-height',
1836
+ 'clip-path',
1837
+ 'clip-rule',
1838
+ 'color-interpolation',
1839
+ 'color-interpolation-filters',
1840
+ 'color-profile',
1841
+ 'color-rendering',
1842
+ 'dominant-baseline',
1843
+ 'enable-background',
1844
+ 'fill-opacity',
1845
+ 'fill-rule',
1846
+ 'flood-color',
1847
+ 'flood-opacity',
1848
+ 'font-family',
1849
+ 'font-size',
1850
+ 'font-size-adjust',
1851
+ 'font-stretch',
1852
+ 'font-style',
1853
+ 'font-variant',
1854
+ 'font-weight',
1855
+ 'glyph-name',
1856
+ 'glyph-orientation-horizontal',
1857
+ 'glyph-orientation-vertical',
1858
+ 'horiz-adv-x',
1859
+ 'horiz-origin-x',
1860
+ 'image-rendering',
1861
+ 'letter-spacing',
1862
+ 'lighting-color',
1863
+ 'marker-end',
1864
+ 'marker-mid',
1865
+ 'marker-start',
1866
+ 'overline-position',
1867
+ 'overline-thickness',
1868
+ 'paint-order',
1869
+ 'panose-1',
1870
+ 'pointer-events',
1871
+ 'rendering-intent',
1872
+ 'shape-rendering',
1873
+ 'stop-color',
1874
+ 'stop-opacity',
1875
+ 'strikethrough-position',
1876
+ 'strikethrough-thickness',
1877
+ 'stroke-dasharray',
1878
+ 'stroke-dashoffset',
1879
+ 'stroke-linecap',
1880
+ 'stroke-linejoin',
1881
+ 'stroke-miterlimit',
1882
+ 'stroke-opacity',
1883
+ 'stroke-width',
1884
+ 'text-anchor',
1885
+ 'text-decoration',
1886
+ 'text-rendering',
1887
+ 'underline-position',
1888
+ 'underline-thickness',
1889
+ 'unicode-bidi',
1890
+ 'unicode-range',
1891
+ 'units-per-em',
1892
+ 'v-alphabetic',
1893
+ 'v-hanging',
1894
+ 'v-ideographic',
1895
+ 'v-mathematical',
1896
+ 'vector-effect',
1897
+ 'vert-adv-y',
1898
+ 'vert-origin-x',
1899
+ 'vert-origin-y',
1900
+ 'word-spacing',
1901
+ 'writing-mode',
1902
+ 'xmlns:xlink',
1903
+ 'x-height',
1904
+
1905
+ // NOTE: if you add a camelCased prop to this list,
1906
+ // you'll need to set attributeName to name.toLowerCase()
1907
+ // instead in the assignment below.
1908
+ ].forEach(attributeName => {
1909
+ const name = attributeName.replace(CAMELIZE, capitalize$1);
1910
+ properties[name] = new PropertyInfoRecord(
1911
+ name,
1912
+ STRING,
1913
+ false, // mustUseProperty
1914
+ attributeName,
1915
+ null, // attributeNamespace
1916
+ false, // sanitizeURL
1917
+ false, // removeEmptyString
1918
+ );
1919
+ });
1759
1920
 
1921
+ // String SVG attributes with the xlink namespace.
1922
+ [
1923
+ 'xlink:actuate',
1924
+ 'xlink:arcrole',
1925
+ 'xlink:role',
1926
+ 'xlink:show',
1927
+ 'xlink:title',
1928
+ 'xlink:type',
1929
+
1930
+ // NOTE: if you add a camelCased prop to this list,
1931
+ // you'll need to set attributeName to name.toLowerCase()
1932
+ // instead in the assignment below.
1933
+ ].forEach(attributeName => {
1934
+ const name = attributeName.replace(CAMELIZE, capitalize$1);
1935
+ properties[name] = new PropertyInfoRecord(
1936
+ name,
1937
+ STRING,
1938
+ false, // mustUseProperty
1939
+ attributeName,
1940
+ 'http://www.w3.org/1999/xlink',
1941
+ false, // sanitizeURL
1942
+ false, // removeEmptyString
1943
+ );
1944
+ });
1760
1945
 
1761
- ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list,
1762
- // you'll need to set attributeName to name.toLowerCase()
1763
- // instead in the assignment below.
1764
- ].forEach(function (attributeName) {
1765
- var name = attributeName.replace(CAMELIZE, capitalize$1);
1766
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
1767
- attributeName, null, // attributeNamespace
1768
- false, // sanitizeURL
1769
- false);
1770
- }); // String SVG attributes with the xlink namespace.
1771
-
1772
- ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list,
1773
- // you'll need to set attributeName to name.toLowerCase()
1774
- // instead in the assignment below.
1775
- ].forEach(function (attributeName) {
1776
- var name = attributeName.replace(CAMELIZE, capitalize$1);
1777
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
1778
- attributeName, 'http://www.w3.org/1999/xlink', false, // sanitizeURL
1779
- false);
1780
- }); // String SVG attributes with the xml namespace.
1781
-
1782
- ['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list,
1783
- // you'll need to set attributeName to name.toLowerCase()
1784
- // instead in the assignment below.
1785
- ].forEach(function (attributeName) {
1786
- var name = attributeName.replace(CAMELIZE, capitalize$1);
1787
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
1788
- attributeName, 'http://www.w3.org/XML/1998/namespace', false, // sanitizeURL
1789
- false);
1790
- }); // These attribute exists both in HTML and SVG.
1946
+ // String SVG attributes with the xml namespace.
1947
+ [
1948
+ 'xml:base',
1949
+ 'xml:lang',
1950
+ 'xml:space',
1951
+
1952
+ // NOTE: if you add a camelCased prop to this list,
1953
+ // you'll need to set attributeName to name.toLowerCase()
1954
+ // instead in the assignment below.
1955
+ ].forEach(attributeName => {
1956
+ const name = attributeName.replace(CAMELIZE, capitalize$1);
1957
+ properties[name] = new PropertyInfoRecord(
1958
+ name,
1959
+ STRING,
1960
+ false, // mustUseProperty
1961
+ attributeName,
1962
+ 'http://www.w3.org/XML/1998/namespace',
1963
+ false, // sanitizeURL
1964
+ false, // removeEmptyString
1965
+ );
1966
+ });
1967
+
1968
+ // These attribute exists both in HTML and SVG.
1791
1969
  // The attribute name is case-sensitive in SVG so we can't just use
1792
1970
  // the React name like we do for attributes that exist only in HTML.
1971
+ ['tabIndex', 'crossOrigin'].forEach(attributeName => {
1972
+ properties[attributeName] = new PropertyInfoRecord(
1973
+ attributeName,
1974
+ STRING,
1975
+ false, // mustUseProperty
1976
+ attributeName.toLowerCase(), // attributeName
1977
+ null, // attributeNamespace
1978
+ false, // sanitizeURL
1979
+ false, // removeEmptyString
1980
+ );
1981
+ });
1793
1982
 
1794
- ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
1795
- properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
1796
- attributeName.toLowerCase(), // attributeName
1797
- null, // attributeNamespace
1798
- false, // sanitizeURL
1799
- false);
1800
- }); // These attributes accept URLs. These must not allow javascript: URLS.
1983
+ // These attributes accept URLs. These must not allow javascript: URLS.
1801
1984
  // These will also need to accept Trusted Types object in the future.
1802
-
1803
- var xlinkHref = 'xlinkHref';
1804
- properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
1805
- 'xlink:href', 'http://www.w3.org/1999/xlink', true, // sanitizeURL
1806
- false);
1807
- ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
1808
- properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
1809
- attributeName.toLowerCase(), // attributeName
1810
- null, // attributeNamespace
1985
+ const xlinkHref = 'xlinkHref';
1986
+ properties[xlinkHref] = new PropertyInfoRecord(
1987
+ 'xlinkHref',
1988
+ STRING,
1989
+ false, // mustUseProperty
1990
+ 'xlink:href',
1991
+ 'http://www.w3.org/1999/xlink',
1811
1992
  true, // sanitizeURL
1812
- true);
1993
+ false, // removeEmptyString
1994
+ );
1995
+
1996
+ ['src', 'href', 'action', 'formAction'].forEach(attributeName => {
1997
+ properties[attributeName] = new PropertyInfoRecord(
1998
+ attributeName,
1999
+ STRING,
2000
+ false, // mustUseProperty
2001
+ attributeName.toLowerCase(), // attributeName
2002
+ null, // attributeNamespace
2003
+ true, // sanitizeURL
2004
+ true, // removeEmptyString
2005
+ );
1813
2006
  });
1814
2007
 
1815
- var _require = possibleStandardNamesOptimized$1,
1816
- CAMELCASE = _require.CAMELCASE,
1817
- SAME = _require.SAME,
1818
- possibleStandardNamesOptimized = _require.possibleStandardNames;
2008
+ //
2009
+ const {
2010
+ CAMELCASE,
2011
+ SAME,
2012
+ possibleStandardNames: possibleStandardNamesOptimized
2013
+ } = possibleStandardNamesOptimized$1;
2014
+
2015
+ const ATTRIBUTE_NAME_START_CHAR =
2016
+ ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
2017
+
2018
+ const ATTRIBUTE_NAME_CHAR =
2019
+ ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
1819
2020
 
1820
- var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
1821
- var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
1822
2021
  /**
1823
2022
  * Checks whether a property name is a custom attribute.
1824
2023
  *
1825
- * @see {@link https://github.com/facebook/react/blob/15-stable/src/renderers/dom/shared/HTMLDOMPropertyConfig.js#L23-L25}
2024
+ * @see https://github.com/facebook/react/blob/15-stable/src/renderers/dom/shared/HTMLDOMPropertyConfig.js#L23-L25
1826
2025
  *
1827
- * @param {string}
1828
- * @return {boolean}
2026
+ * @type {(attribute: string) => boolean}
1829
2027
  */
2028
+ const isCustomAttribute =
2029
+ RegExp.prototype.test.bind(
2030
+ // eslint-disable-next-line no-misleading-character-class
2031
+ new RegExp('^(data|aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$')
2032
+ );
1830
2033
 
1831
- var isCustomAttribute = RegExp.prototype.test.bind( // eslint-disable-next-line no-misleading-character-class
1832
- new RegExp('^(data|aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$'));
1833
- var possibleStandardNames = Object.keys(possibleStandardNamesOptimized).reduce(function (accumulator, standardName) {
1834
- var propName = possibleStandardNamesOptimized[standardName];
1835
-
2034
+ /**
2035
+ * @type {Record<string, string>}
2036
+ */
2037
+ const possibleStandardNames = Object.keys(
2038
+ possibleStandardNamesOptimized
2039
+ ).reduce((accumulator, standardName) => {
2040
+ const propName = possibleStandardNamesOptimized[standardName];
1836
2041
  if (propName === SAME) {
1837
2042
  accumulator[standardName] = standardName;
1838
2043
  } else if (propName === CAMELCASE) {
@@ -1840,7 +2045,6 @@
1840
2045
  } else {
1841
2046
  accumulator[standardName] = propName;
1842
2047
  }
1843
-
1844
2048
  return accumulator;
1845
2049
  }, {});
1846
2050