html-react-parser 3.0.2 → 3.0.3
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.
|
@@ -1565,13 +1565,15 @@
|
|
|
1565
1565
|
);
|
|
1566
1566
|
};
|
|
1567
1567
|
|
|
1568
|
+
var DOMParser = typeof window === 'object' && window.DOMParser;
|
|
1569
|
+
|
|
1568
1570
|
/**
|
|
1569
1571
|
* DOMParser (performance: slow).
|
|
1570
1572
|
*
|
|
1571
1573
|
* @see https://developer.mozilla.org/docs/Web/API/DOMParser#Parsing_an_SVG_or_HTML_document
|
|
1572
1574
|
*/
|
|
1573
|
-
if (typeof
|
|
1574
|
-
var domParser = new
|
|
1575
|
+
if (typeof DOMParser === 'function') {
|
|
1576
|
+
var domParser = new DOMParser();
|
|
1575
1577
|
var mimeType = 'text/html';
|
|
1576
1578
|
|
|
1577
1579
|
/**
|
|
@@ -1597,7 +1599,7 @@
|
|
|
1597
1599
|
*
|
|
1598
1600
|
* @see https://developer.mozilla.org/docs/Web/API/DOMImplementation/createHTMLDocument
|
|
1599
1601
|
*/
|
|
1600
|
-
if (document.implementation) {
|
|
1602
|
+
if (typeof document === 'object' && document.implementation) {
|
|
1601
1603
|
var doc = document.implementation.createHTMLDocument();
|
|
1602
1604
|
|
|
1603
1605
|
/**
|
|
@@ -1624,7 +1626,9 @@
|
|
|
1624
1626
|
*
|
|
1625
1627
|
* @see https://developer.mozilla.org/docs/Web/HTML/Element/template
|
|
1626
1628
|
*/
|
|
1627
|
-
var template =
|
|
1629
|
+
var template =
|
|
1630
|
+
typeof document === 'object' ? document.createElement('template') : {};
|
|
1631
|
+
|
|
1628
1632
|
var parseFromTemplate;
|
|
1629
1633
|
|
|
1630
1634
|
if (template.content) {
|