html-react-parser 3.0.10 → 3.0.11

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.
@@ -2409,6 +2409,16 @@
2409
2409
  var reactProperty = lib;
2410
2410
  var utilities$1 = utilities$2;
2411
2411
 
2412
+ // https://reactjs.org/docs/uncontrolled-components.html
2413
+ // https://developer.mozilla.org/docs/Web/HTML/Attributes
2414
+ var UNCONTROLLED_COMPONENT_ATTRIBUTES = ['checked', 'value'];
2415
+ var UNCONTROLLED_COMPONENT_NAMES = ['input', 'select', 'textarea'];
2416
+
2417
+ var VALUE_ONLY_INPUTS = {
2418
+ reset: true,
2419
+ submit: true
2420
+ };
2421
+
2412
2422
  /**
2413
2423
  * Converts HTML/SVG DOM attributes to React props.
2414
2424
  *
@@ -2419,18 +2429,13 @@
2419
2429
  var attributesToProps$2 = function attributesToProps(attributes, nodeName) {
2420
2430
  attributes = attributes || {};
2421
2431
 
2422
- var valueOnlyInputs = {
2423
- reset: true,
2424
- submit: true
2425
- };
2426
-
2427
2432
  var attributeName;
2428
2433
  var attributeNameLowerCased;
2429
2434
  var attributeValue;
2430
2435
  var propName;
2431
2436
  var propertyInfo;
2432
2437
  var props = {};
2433
- var inputIsValueOnly = attributes.type && valueOnlyInputs[attributes.type];
2438
+ var inputIsValueOnly = attributes.type && VALUE_ONLY_INPUTS[attributes.type];
2434
2439
 
2435
2440
  for (attributeName in attributes) {
2436
2441
  attributeValue = attributes[attributeName];
@@ -2449,10 +2454,9 @@
2449
2454
  propertyInfo = reactProperty.getPropertyInfo(propName);
2450
2455
 
2451
2456
  // convert attribute to uncontrolled component prop (e.g., `value` to `defaultValue`)
2452
- // https://reactjs.org/docs/uncontrolled-components.html
2453
2457
  if (
2454
- (propName === 'checked' || propName === 'value') &&
2455
- nodeName !== 'option' &&
2458
+ UNCONTROLLED_COMPONENT_ATTRIBUTES.indexOf(propName) !== -1 &&
2459
+ UNCONTROLLED_COMPONENT_NAMES.indexOf(nodeName) !== -1 &&
2456
2460
  !inputIsValueOnly
2457
2461
  ) {
2458
2462
  propName = getPropName('default' + attributeNameLowerCased);