html-react-parser 4.2.9 → 4.2.10
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.
|
@@ -756,6 +756,7 @@
|
|
|
756
756
|
*/
|
|
757
757
|
parseFromString = function (html, tagName) {
|
|
758
758
|
if (tagName) {
|
|
759
|
+
/* istanbul ignore next */
|
|
759
760
|
html = "<".concat(tagName, ">").concat(html, "</").concat(tagName, ">");
|
|
760
761
|
}
|
|
761
762
|
return domParser_1.parseFromString(html, mimeType_1);
|
|
@@ -962,7 +963,7 @@
|
|
|
962
963
|
*/
|
|
963
964
|
function formatDOM(nodes, parent, directive) {
|
|
964
965
|
if (parent === void 0) { parent = null; }
|
|
965
|
-
var
|
|
966
|
+
var domNodes = [];
|
|
966
967
|
var current;
|
|
967
968
|
var index = 0;
|
|
968
969
|
var nodesLength = nodes.length;
|
|
@@ -991,7 +992,7 @@
|
|
|
991
992
|
continue;
|
|
992
993
|
}
|
|
993
994
|
// set previous node next
|
|
994
|
-
var prev =
|
|
995
|
+
var prev = domNodes[index - 1] || null;
|
|
995
996
|
if (prev) {
|
|
996
997
|
prev.next = current;
|
|
997
998
|
}
|
|
@@ -999,18 +1000,18 @@
|
|
|
999
1000
|
current.parent = parent;
|
|
1000
1001
|
current.prev = prev;
|
|
1001
1002
|
current.next = null;
|
|
1002
|
-
|
|
1003
|
+
domNodes.push(current);
|
|
1003
1004
|
}
|
|
1004
1005
|
if (directive) {
|
|
1005
1006
|
current = new domhandler_1.ProcessingInstruction(directive.substring(0, directive.indexOf(' ')).toLowerCase(), directive);
|
|
1006
|
-
current.next =
|
|
1007
|
+
current.next = domNodes[0] || null;
|
|
1007
1008
|
current.parent = parent;
|
|
1008
|
-
|
|
1009
|
-
if (
|
|
1010
|
-
|
|
1009
|
+
domNodes.unshift(current);
|
|
1010
|
+
if (domNodes[1]) {
|
|
1011
|
+
domNodes[1].prev = domNodes[0];
|
|
1011
1012
|
}
|
|
1012
1013
|
}
|
|
1013
|
-
return
|
|
1014
|
+
return domNodes;
|
|
1014
1015
|
}
|
|
1015
1016
|
utilities$4.formatDOM = formatDOM;
|
|
1016
1017
|
|
|
@@ -1031,7 +1032,7 @@
|
|
|
1031
1032
|
if (typeof html !== 'string') {
|
|
1032
1033
|
throw new TypeError('First argument must be a string');
|
|
1033
1034
|
}
|
|
1034
|
-
if (html
|
|
1035
|
+
if (!html) {
|
|
1035
1036
|
return [];
|
|
1036
1037
|
}
|
|
1037
1038
|
// match directive
|