html-react-parser 3.0.5 → 3.0.7
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 +13 -4
- 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 +5 -1
- package/lib/attributes-to-props.js +3 -1
- package/lib/dom-to-react.js +1 -1
- package/package.json +7 -7
|
@@ -10,6 +10,10 @@ export type Props = Record<string, string> & {
|
|
|
10
10
|
* Converts HTML/SVG DOM attributes to React props.
|
|
11
11
|
*
|
|
12
12
|
* @param attributes - HTML/SVG DOM attributes.
|
|
13
|
+
* @param nodeName - DOM node name.
|
|
13
14
|
* @returns - React props.
|
|
14
15
|
*/
|
|
15
|
-
export default function attributesToProps(
|
|
16
|
+
export default function attributesToProps(
|
|
17
|
+
attributes: Attributes,
|
|
18
|
+
nodeName?: string
|
|
19
|
+
): Props;
|
|
@@ -5,9 +5,10 @@ var utilities = require('./utilities');
|
|
|
5
5
|
* Converts HTML/SVG DOM attributes to React props.
|
|
6
6
|
*
|
|
7
7
|
* @param {object} [attributes={}] - HTML/SVG DOM attributes.
|
|
8
|
+
* @param {string} [nodeName] - DOM node name.
|
|
8
9
|
* @returns - React props.
|
|
9
10
|
*/
|
|
10
|
-
module.exports = function attributesToProps(attributes) {
|
|
11
|
+
module.exports = function attributesToProps(attributes, nodeName) {
|
|
11
12
|
attributes = attributes || {};
|
|
12
13
|
|
|
13
14
|
var valueOnlyInputs = {
|
|
@@ -43,6 +44,7 @@ module.exports = function attributesToProps(attributes) {
|
|
|
43
44
|
// https://reactjs.org/docs/uncontrolled-components.html
|
|
44
45
|
if (
|
|
45
46
|
(propName === 'checked' || propName === 'value') &&
|
|
47
|
+
nodeName !== 'option' &&
|
|
46
48
|
!inputIsValueOnly
|
|
47
49
|
) {
|
|
48
50
|
propName = getPropName('default' + attributeNameLowerCased);
|
package/lib/dom-to-react.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "html-react-parser",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"description": "HTML to React parser.",
|
|
5
5
|
"author": "Mark <mark@remarkablemark.org>",
|
|
6
6
|
"main": "index.js",
|
|
@@ -47,21 +47,21 @@
|
|
|
47
47
|
"domhandler": "5.0.3",
|
|
48
48
|
"html-dom-parser": "3.1.2",
|
|
49
49
|
"react-property": "2.0.0",
|
|
50
|
-
"style-to-js": "1.1.
|
|
50
|
+
"style-to-js": "1.1.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@commitlint/cli": "17.
|
|
54
|
-
"@commitlint/config-conventional": "17.
|
|
53
|
+
"@commitlint/cli": "17.4.0",
|
|
54
|
+
"@commitlint/config-conventional": "17.4.0",
|
|
55
55
|
"@rollup/plugin-commonjs": "24.0.0",
|
|
56
56
|
"@rollup/plugin-node-resolve": "15.0.1",
|
|
57
57
|
"@size-limit/preset-big-lib": "8.1.0",
|
|
58
58
|
"@types/react": "18.0.26",
|
|
59
|
-
"@typescript-eslint/parser": "5.
|
|
59
|
+
"@typescript-eslint/parser": "5.48.0",
|
|
60
60
|
"benchmark": "2.1.4",
|
|
61
61
|
"dtslint": "4.2.1",
|
|
62
|
-
"eslint": "8.
|
|
62
|
+
"eslint": "8.31.0",
|
|
63
63
|
"eslint-plugin-prettier": "4.2.1",
|
|
64
|
-
"husky": "8.0.
|
|
64
|
+
"husky": "8.0.3",
|
|
65
65
|
"jest": "29.3.1",
|
|
66
66
|
"jest-environment-jsdom": "29.3.1",
|
|
67
67
|
"lint-staged": "13.1.0",
|