html-react-parser 5.0.3 → 5.0.5
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.
- package/README.md +1 -1
- package/dist/html-react-parser.js +4 -5
- package/dist/html-react-parser.js.map +1 -1
- package/dist/html-react-parser.min.js +1 -1
- package/dist/html-react-parser.min.js.map +1 -1
- package/lib/attributes-to-props.d.ts +9 -3
- package/lib/attributes-to-props.d.ts.map +1 -1
- package/lib/attributes-to-props.js +3 -4
- package/lib/attributes-to-props.js.map +1 -1
- package/lib/dom-to-react.js.map +1 -1
- package/lib/utilities.d.ts +2 -2
- package/lib/utilities.d.ts.map +1 -1
- package/lib/utilities.js +1 -1
- package/lib/utilities.js.map +1 -1
- package/package.json +9 -9
- package/src/attributes-to-props.ts +10 -9
- package/src/dom-to-react.ts +1 -1
- package/src/utilities.ts +12 -6
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ import parse from 'html-react-parser';
|
|
|
27
27
|
parse('<p>Hello, World!</p>'); // React.createElement('p', {}, 'Hello, World!')
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
[Replit](https://replit.com/@remarkablemark/html-react-parser) | [JSFiddle](https://jsfiddle.net/remarkablemark/7v86d800/) | [CodeSandbox](https://codesandbox.io/s/940pov1l4w) | [TypeScript](https://codesandbox.io/s/html-react-parser-z0kp6) | [Examples](https://github.com/remarkablemark/html-react-parser/tree/master/examples)
|
|
30
|
+
[Replit](https://replit.com/@remarkablemark/html-react-parser) | [JSFiddle](https://jsfiddle.net/remarkablemark/7v86d800/) | [CodeSandbox](https://codesandbox.io/s/940pov1l4w) | [TypeScript](https://codesandbox.io/s/html-react-parser-z0kp6) | [Vite](https://codesandbox.io/p/sandbox/html-react-parser-fg2jpw) | [Examples](https://github.com/remarkablemark/html-react-parser/tree/master/examples)
|
|
31
31
|
|
|
32
32
|
<details>
|
|
33
33
|
<summary>Table of Contents</summary>
|
|
@@ -2485,7 +2485,7 @@
|
|
|
2485
2485
|
* @returns - Whether the tag is custom component.
|
|
2486
2486
|
*/
|
|
2487
2487
|
function isCustomComponent(tagName, props) {
|
|
2488
|
-
if (tagName.
|
|
2488
|
+
if (!tagName.includes('-')) {
|
|
2489
2489
|
return Boolean(props && typeof props.is === 'string');
|
|
2490
2490
|
}
|
|
2491
2491
|
// These are reserved SVG and MathML elements.
|
|
@@ -2583,8 +2583,7 @@
|
|
|
2583
2583
|
function attributesToProps(attributes, nodeName) {
|
|
2584
2584
|
if (attributes === void 0) { attributes = {}; }
|
|
2585
2585
|
var props = {};
|
|
2586
|
-
var isInputValueOnly = Boolean(attributes.type &&
|
|
2587
|
-
valueOnlyInputs[attributes.type]);
|
|
2586
|
+
var isInputValueOnly = Boolean(attributes.type && valueOnlyInputs[attributes.type]);
|
|
2588
2587
|
for (var attributeName in attributes) {
|
|
2589
2588
|
var attributeValue = attributes[attributeName];
|
|
2590
2589
|
// ARIA (aria-*) or custom data (data-*) attribute
|
|
@@ -2598,8 +2597,8 @@
|
|
|
2598
2597
|
if (propName) {
|
|
2599
2598
|
var propertyInfo = (0, react_property_1.getPropertyInfo)(propName);
|
|
2600
2599
|
// convert attribute to uncontrolled component prop (e.g., `value` to `defaultValue`)
|
|
2601
|
-
if (UNCONTROLLED_COMPONENT_ATTRIBUTES.
|
|
2602
|
-
UNCONTROLLED_COMPONENT_NAMES.
|
|
2600
|
+
if (UNCONTROLLED_COMPONENT_ATTRIBUTES.includes(propName) &&
|
|
2601
|
+
UNCONTROLLED_COMPONENT_NAMES.includes(nodeName) &&
|
|
2603
2602
|
!isInputValueOnly) {
|
|
2604
2603
|
propName = getPropName('default' + attributeNameLowerCased);
|
|
2605
2604
|
}
|