html-react-parser 6.1.4 → 6.1.6
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/dist/html-react-parser.js +23 -28
- 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.map +1 -1
- package/lib/attributes-to-props.js.map +1 -1
- package/package.json +26 -26
- package/src/attributes-to-props.ts +1 -2
|
@@ -65,7 +65,13 @@
|
|
|
65
65
|
function requireConstants () {
|
|
66
66
|
if (hasRequiredConstants) return constants;
|
|
67
67
|
hasRequiredConstants = 1;
|
|
68
|
-
|
|
68
|
+
//#region src/client/constants.ts
|
|
69
|
+
/**
|
|
70
|
+
* SVG elements are case-sensitive.
|
|
71
|
+
*
|
|
72
|
+
* @see https://developer.mozilla.org/docs/Web/SVG/Element#svg_elements_a_to_z
|
|
73
|
+
*/
|
|
74
|
+
const CASE_SENSITIVE_TAG_NAMES = [
|
|
69
75
|
"animateMotion",
|
|
70
76
|
"animateTransform",
|
|
71
77
|
"clipPath",
|
|
@@ -97,11 +103,13 @@
|
|
|
97
103
|
"linearGradient",
|
|
98
104
|
"radialGradient",
|
|
99
105
|
"textPath"
|
|
100
|
-
]
|
|
106
|
+
];
|
|
107
|
+
const CASE_SENSITIVE_TAG_NAMES_MAP = CASE_SENSITIVE_TAG_NAMES.reduce((accumulator, tagName) => {
|
|
101
108
|
accumulator[tagName.toLowerCase()] = tagName;
|
|
102
109
|
return accumulator;
|
|
103
110
|
}, {});
|
|
104
111
|
//#endregion
|
|
112
|
+
constants.CASE_SENSITIVE_TAG_NAMES = CASE_SENSITIVE_TAG_NAMES;
|
|
105
113
|
constants.CASE_SENSITIVE_TAG_NAMES_MAP = CASE_SENSITIVE_TAG_NAMES_MAP;
|
|
106
114
|
|
|
107
115
|
|
|
@@ -839,6 +847,7 @@
|
|
|
839
847
|
utilities$1.escapeSpecialCharacters = escapeSpecialCharacters;
|
|
840
848
|
utilities$1.formatDOM = formatDOM;
|
|
841
849
|
utilities$1.hasOpenTag = hasOpenTag;
|
|
850
|
+
utilities$1.revertEscapedCharacters = revertEscapedCharacters;
|
|
842
851
|
|
|
843
852
|
|
|
844
853
|
return utilities$1;
|
|
@@ -971,6 +980,7 @@
|
|
|
971
980
|
}
|
|
972
981
|
//#endregion
|
|
973
982
|
domparser.default = domparser$1;
|
|
983
|
+
domparser.getHTMLForInnerHTML = getHTMLForInnerHTML;
|
|
974
984
|
|
|
975
985
|
|
|
976
986
|
return domparser;
|
|
@@ -2057,7 +2067,7 @@
|
|
|
2057
2067
|
|
|
2058
2068
|
// http://www.w3.org/TR/CSS21/grammar.html
|
|
2059
2069
|
// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
|
|
2060
|
-
var COMMENT_REGEX = /\/\*[^*]
|
|
2070
|
+
var COMMENT_REGEX = /\/\*(?:[^*]|\*(?!\/))*\*\//g;
|
|
2061
2071
|
|
|
2062
2072
|
var NEWLINE_REGEX = /\n/g;
|
|
2063
2073
|
var WHITESPACE_REGEX = /^\s*/;
|
|
@@ -2065,12 +2075,10 @@
|
|
|
2065
2075
|
// declaration
|
|
2066
2076
|
var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
|
|
2067
2077
|
var COLON_REGEX = /^:\s*/;
|
|
2068
|
-
var VALUE_REGEX =
|
|
2078
|
+
var VALUE_REGEX =
|
|
2079
|
+
/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/;
|
|
2069
2080
|
var SEMICOLON_REGEX = /^[;\s]*/;
|
|
2070
2081
|
|
|
2071
|
-
// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
|
|
2072
|
-
var TRIM_REGEX = /^\s+|\s+$/g;
|
|
2073
|
-
|
|
2074
2082
|
// strings
|
|
2075
2083
|
var NEWLINE = '\n';
|
|
2076
2084
|
var FORWARD_SLASH = '/';
|
|
@@ -2194,16 +2202,13 @@
|
|
|
2194
2202
|
/**
|
|
2195
2203
|
* Parse comments.
|
|
2196
2204
|
*
|
|
2197
|
-
* @param {Object[]}
|
|
2205
|
+
* @param {Object[]} rules
|
|
2198
2206
|
* @return {Object[]}
|
|
2199
2207
|
*/
|
|
2200
2208
|
function comments(rules) {
|
|
2201
2209
|
var c;
|
|
2202
|
-
rules = rules || [];
|
|
2203
2210
|
while ((c = comment())) {
|
|
2204
|
-
|
|
2205
|
-
rules.push(c);
|
|
2206
|
-
}
|
|
2211
|
+
rules.push(c);
|
|
2207
2212
|
}
|
|
2208
2213
|
return rules;
|
|
2209
2214
|
}
|
|
@@ -2265,9 +2270,9 @@
|
|
|
2265
2270
|
|
|
2266
2271
|
var ret = pos({
|
|
2267
2272
|
type: TYPE_DECLARATION,
|
|
2268
|
-
property:
|
|
2273
|
+
property: prop[0].replace(COMMENT_REGEX, EMPTY_STRING).trim(),
|
|
2269
2274
|
value: val
|
|
2270
|
-
?
|
|
2275
|
+
? val[0].replace(COMMENT_REGEX, EMPTY_STRING).trim()
|
|
2271
2276
|
: EMPTY_STRING
|
|
2272
2277
|
});
|
|
2273
2278
|
|
|
@@ -2290,10 +2295,8 @@
|
|
|
2290
2295
|
// declarations
|
|
2291
2296
|
var decl;
|
|
2292
2297
|
while ((decl = declaration())) {
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
comments(decls);
|
|
2296
|
-
}
|
|
2298
|
+
decls.push(decl);
|
|
2299
|
+
comments(decls);
|
|
2297
2300
|
}
|
|
2298
2301
|
|
|
2299
2302
|
return decls;
|
|
@@ -2303,16 +2306,6 @@
|
|
|
2303
2306
|
return declarations();
|
|
2304
2307
|
}
|
|
2305
2308
|
|
|
2306
|
-
/**
|
|
2307
|
-
* Trim `str`.
|
|
2308
|
-
*
|
|
2309
|
-
* @param {String} str
|
|
2310
|
-
* @return {String}
|
|
2311
|
-
*/
|
|
2312
|
-
function trim(str) {
|
|
2313
|
-
return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
|
|
2314
|
-
}
|
|
2315
|
-
|
|
2316
2309
|
cjs$1 = index;
|
|
2317
2310
|
|
|
2318
2311
|
return cjs$1;
|
|
@@ -2459,6 +2452,8 @@
|
|
|
2459
2452
|
}
|
|
2460
2453
|
//#endregion
|
|
2461
2454
|
dist = StyleToJS;
|
|
2455
|
+
|
|
2456
|
+
|
|
2462
2457
|
return dist;
|
|
2463
2458
|
}
|
|
2464
2459
|
|