html-react-parser 3.0.9 → 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.
|
@@ -1007,7 +1007,11 @@
|
|
|
1007
1007
|
formatTagName(node.nodeName),
|
|
1008
1008
|
formatAttributes(node.attributes)
|
|
1009
1009
|
);
|
|
1010
|
-
current.children = formatDOM$1(
|
|
1010
|
+
current.children = formatDOM$1(
|
|
1011
|
+
// template children are on content
|
|
1012
|
+
node.content ? node.content.childNodes : node.childNodes,
|
|
1013
|
+
current
|
|
1014
|
+
);
|
|
1011
1015
|
break;
|
|
1012
1016
|
|
|
1013
1017
|
case 3:
|
|
@@ -2405,6 +2409,16 @@
|
|
|
2405
2409
|
var reactProperty = lib;
|
|
2406
2410
|
var utilities$1 = utilities$2;
|
|
2407
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
|
+
|
|
2408
2422
|
/**
|
|
2409
2423
|
* Converts HTML/SVG DOM attributes to React props.
|
|
2410
2424
|
*
|
|
@@ -2415,18 +2429,13 @@
|
|
|
2415
2429
|
var attributesToProps$2 = function attributesToProps(attributes, nodeName) {
|
|
2416
2430
|
attributes = attributes || {};
|
|
2417
2431
|
|
|
2418
|
-
var valueOnlyInputs = {
|
|
2419
|
-
reset: true,
|
|
2420
|
-
submit: true
|
|
2421
|
-
};
|
|
2422
|
-
|
|
2423
2432
|
var attributeName;
|
|
2424
2433
|
var attributeNameLowerCased;
|
|
2425
2434
|
var attributeValue;
|
|
2426
2435
|
var propName;
|
|
2427
2436
|
var propertyInfo;
|
|
2428
2437
|
var props = {};
|
|
2429
|
-
var inputIsValueOnly = attributes.type &&
|
|
2438
|
+
var inputIsValueOnly = attributes.type && VALUE_ONLY_INPUTS[attributes.type];
|
|
2430
2439
|
|
|
2431
2440
|
for (attributeName in attributes) {
|
|
2432
2441
|
attributeValue = attributes[attributeName];
|
|
@@ -2445,10 +2454,9 @@
|
|
|
2445
2454
|
propertyInfo = reactProperty.getPropertyInfo(propName);
|
|
2446
2455
|
|
|
2447
2456
|
// convert attribute to uncontrolled component prop (e.g., `value` to `defaultValue`)
|
|
2448
|
-
// https://reactjs.org/docs/uncontrolled-components.html
|
|
2449
2457
|
if (
|
|
2450
|
-
(propName
|
|
2451
|
-
nodeName !==
|
|
2458
|
+
UNCONTROLLED_COMPONENT_ATTRIBUTES.indexOf(propName) !== -1 &&
|
|
2459
|
+
UNCONTROLLED_COMPONENT_NAMES.indexOf(nodeName) !== -1 &&
|
|
2452
2460
|
!inputIsValueOnly
|
|
2453
2461
|
) {
|
|
2454
2462
|
propName = getPropName('default' + attributeNameLowerCased);
|