@tryghost/kg-clean-basic-html
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -9,3 +9,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('cleanBasicHtml() 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 @@ }; |
@@ -7,3 +7,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('cleanBasicHtml() must be passed a `createDocument` function as an option when used in a non-browser environment'); | ||
@@ -13,3 +15,3 @@ } | ||
options.createDocument = function (html) { | ||
const parser = new (DOMParser || window && window.DOMParser)(); | ||
const parser = new Parser(); | ||
return parser.parseFromString(html, 'text/html'); | ||
@@ -16,0 +18,0 @@ }; |
@@ -7,3 +7,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('cleanBasicHtml() must be passed a `createDocument` function as an option when used in a non-browser environment'); | ||
@@ -13,3 +15,3 @@ } | ||
options.createDocument = function (html) { | ||
const parser = new (DOMParser || (window && window.DOMParser))(); | ||
const parser = new Parser(); | ||
return parser.parseFromString(html, 'text/html'); | ||
@@ -16,0 +18,0 @@ }; |
{ | ||
"name": "@tryghost/kg-clean-basic-html", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"repository": "https://github.com/TryGhost/Koenig/tree/master/packages/kg-clean-basic-html", | ||
@@ -39,3 +39,3 @@ "author": "Ghost Foundation", | ||
}, | ||
"gitHead": "2d7cb5a6473209823964068740b1e3d334f5cfa0" | ||
"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
10339
112