html-react-parser 4.2.8 → 4.2.9

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