@tryghost/kg-parser-plugins
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -14,3 +14,5 @@ 'use strict'; | ||
if (!options.createDocument) { | ||
if (!DOMParser || (window && !window.DOMParser)) { | ||
const Parser = (typeof DOMParser !== 'undefined' && DOMParser) || (typeof window !== 'undefined' && window.DOMParser); | ||
if (!Parser) { | ||
throw new Error('createParserPlugins() must be passed a `createDocument` function as an option when used in a non-browser environment'); | ||
@@ -20,3 +22,3 @@ } | ||
options.createDocument = function (html) { | ||
const parser = new (DOMParser || (window && window.DOMParser))(); | ||
const parser = new Parser(); | ||
return parser.parseFromString(html, 'text/html'); | ||
@@ -23,0 +25,0 @@ }; |
@@ -9,3 +9,5 @@ import cleanBasicHtml from '@tryghost/kg-clean-basic-html'; | ||
if (!options.createDocument) { | ||
if (!DOMParser || window && !window.DOMParser) { | ||
const Parser = typeof DOMParser !== 'undefined' && DOMParser || typeof window !== 'undefined' && window.DOMParser; | ||
if (!Parser) { | ||
throw new Error('createParserPlugins() must be passed a `createDocument` function as an option when used in a non-browser environment'); | ||
@@ -15,3 +17,3 @@ } | ||
options.createDocument = function (html) { | ||
const parser = new (DOMParser || window && window.DOMParser)(); | ||
const parser = new Parser(); | ||
return parser.parseFromString(html, 'text/html'); | ||
@@ -18,0 +20,0 @@ }; |
@@ -19,3 +19,5 @@ /* global DOMParser, window */ | ||
if (!options.createDocument) { | ||
if (!DOMParser || (window && !window.DOMParser)) { | ||
const Parser = (typeof DOMParser !== 'undefined' && DOMParser) || (typeof window !== 'undefined' && window.DOMParser); | ||
if (!Parser) { | ||
throw new Error('createParserPlugins() must be passed a `createDocument` function as an option when used in a non-browser environment'); | ||
@@ -25,3 +27,3 @@ } | ||
options.createDocument = function (html) { | ||
const parser = new (DOMParser || (window && window.DOMParser))(); | ||
const parser = new Parser(); | ||
return parser.parseFromString(html, 'text/html'); | ||
@@ -28,0 +30,0 @@ }; |
{ | ||
"name": "@tryghost/kg-parser-plugins", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"repository": "https://github.com/TryGhost/Ghost-SDK/tree/master/packages/kg-parser-plugins", | ||
@@ -41,5 +41,5 @@ "author": "Ghost Foundation", | ||
"dependencies": { | ||
"@tryghost/kg-clean-basic-html": "^0.1.0" | ||
"@tryghost/kg-clean-basic-html": "^0.1.1" | ||
}, | ||
"gitHead": "82fc89a5999e3915df9d5dc0792c860370030b7a" | ||
"gitHead": "7e077269871e47be21186ee0b19c7b954cb80791" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31191
439