html-react-parser 1.4.4 → 1.4.8
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.
|
@@ -10,12 +10,18 @@ var utilities = require('./utilities');
|
|
|
10
10
|
module.exports = function attributesToProps(attributes) {
|
|
11
11
|
attributes = attributes || {};
|
|
12
12
|
|
|
13
|
+
var valueOnlyInputs = {
|
|
14
|
+
reset: true,
|
|
15
|
+
submit: true
|
|
16
|
+
};
|
|
17
|
+
|
|
13
18
|
var attributeName;
|
|
14
19
|
var attributeNameLowerCased;
|
|
15
20
|
var attributeValue;
|
|
16
21
|
var propName;
|
|
17
22
|
var propertyInfo;
|
|
18
23
|
var props = {};
|
|
24
|
+
var inputIsValueOnly = attributes.type && valueOnlyInputs[attributes.type];
|
|
19
25
|
|
|
20
26
|
for (attributeName in attributes) {
|
|
21
27
|
attributeValue = attributes[attributeName];
|
|
@@ -35,7 +41,10 @@ module.exports = function attributesToProps(attributes) {
|
|
|
35
41
|
|
|
36
42
|
// convert attribute to uncontrolled component prop (e.g., `value` to `defaultValue`)
|
|
37
43
|
// https://reactjs.org/docs/uncontrolled-components.html
|
|
38
|
-
if (
|
|
44
|
+
if (
|
|
45
|
+
(propName === 'checked' || propName === 'value') &&
|
|
46
|
+
!inputIsValueOnly
|
|
47
|
+
) {
|
|
39
48
|
propName = getPropName('default' + attributeNameLowerCased);
|
|
40
49
|
}
|
|
41
50
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "html-react-parser",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.8",
|
|
4
4
|
"description": "HTML to React parser.",
|
|
5
5
|
"author": "Mark <mark@remarkablemark.org>",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"module": "index.mjs",
|
|
8
|
+
"exports": {
|
|
9
|
+
"import": "./index.mjs",
|
|
10
|
+
"require": "./index.js"
|
|
11
|
+
},
|
|
8
12
|
"scripts": {
|
|
9
13
|
"benchmark": "node benchmark",
|
|
10
14
|
"build": "rollup --config --failAfterWarnings",
|
|
@@ -38,35 +42,35 @@
|
|
|
38
42
|
],
|
|
39
43
|
"dependencies": {
|
|
40
44
|
"domhandler": "4.3.0",
|
|
41
|
-
"html-dom-parser": "1.0
|
|
45
|
+
"html-dom-parser": "1.1.0",
|
|
42
46
|
"react-property": "2.0.0",
|
|
43
47
|
"style-to-js": "1.1.0"
|
|
44
48
|
},
|
|
45
49
|
"devDependencies": {
|
|
46
|
-
"@commitlint/cli": "
|
|
47
|
-
"@commitlint/config-conventional": "
|
|
50
|
+
"@commitlint/cli": "16.1.0",
|
|
51
|
+
"@commitlint/config-conventional": "16.0.0",
|
|
48
52
|
"@rollup/plugin-commonjs": "21.0.1",
|
|
49
|
-
"@rollup/plugin-node-resolve": "13.1.
|
|
53
|
+
"@rollup/plugin-node-resolve": "13.1.3",
|
|
50
54
|
"@size-limit/preset-big-lib": "7.0.4",
|
|
51
|
-
"@types/react": "17.0.
|
|
52
|
-
"@typescript-eslint/parser": "5.
|
|
55
|
+
"@types/react": "17.0.39",
|
|
56
|
+
"@typescript-eslint/parser": "5.10.2",
|
|
53
57
|
"benchmark": "2.1.4",
|
|
54
58
|
"dtslint": "4.2.1",
|
|
55
|
-
"eslint": "8.
|
|
59
|
+
"eslint": "8.8.0",
|
|
56
60
|
"eslint-plugin-prettier": "4.0.0",
|
|
57
61
|
"husky": "7.0.4",
|
|
58
|
-
"jest": "27.4.
|
|
59
|
-
"lint-staged": "12.
|
|
62
|
+
"jest": "27.4.7",
|
|
63
|
+
"lint-staged": "12.3.3",
|
|
60
64
|
"pinst": "2.1.6",
|
|
61
|
-
"preact": "10.6.
|
|
65
|
+
"preact": "10.6.5",
|
|
62
66
|
"prettier": "2.5.1",
|
|
63
67
|
"react": "17.0.2",
|
|
64
68
|
"react-dom": "17.0.2",
|
|
65
69
|
"rimraf": "3.0.2",
|
|
66
|
-
"rollup": "2.
|
|
70
|
+
"rollup": "2.67.0",
|
|
67
71
|
"rollup-plugin-terser": "7.0.2",
|
|
68
72
|
"size-limit": "7.0.4",
|
|
69
|
-
"typescript": "4.5.
|
|
73
|
+
"typescript": "4.5.5"
|
|
70
74
|
},
|
|
71
75
|
"peerDependencies": {
|
|
72
76
|
"react": "0.14 || 15 || 16 || 17"
|