mobiledoc-dom-renderer
Advanced tools
Comparing version 0.6.4 to 0.6.5
@@ -0,4 +1,12 @@ | ||
<a name="0.6.5"></a> | ||
## 0.6.5 (2017-03-07) | ||
* fix(href-sanitization): Improve protocol detection for href sanitization (#53) ([a91b257](https://github.com/bustlelabs/mobiledoc-dom-renderer/commit/a91b257)) | ||
<a name="0.6.4"></a> | ||
## 0.6.4 (2017-03-06) | ||
* 0.6.4 ([cac185a](https://github.com/bustlelabs/mobiledoc-dom-renderer/commit/cac185a)) | ||
* 0.6.4-0 ([d564abb](https://github.com/bustlelabs/mobiledoc-dom-renderer/commit/d564abb)) | ||
@@ -5,0 +13,0 @@ * 0.6.4-1 ([c7cc41b](https://github.com/bustlelabs/mobiledoc-dom-renderer/commit/c7cc41b)) |
@@ -1000,4 +1000,2 @@ define('mobiledoc-dom-renderer/cards/image', ['exports', 'mobiledoc-dom-renderer/utils/render-type'], function (exports, _mobiledocDomRendererUtilsRenderType) { | ||
define('mobiledoc-dom-renderer/utils/dom', ['exports'], function (exports) { | ||
/* globals module */ | ||
'use strict'; | ||
@@ -1019,7 +1017,2 @@ | ||
} | ||
var isNode = typeof window === 'undefined' && typeof module === 'object' && typeof module.require === 'function'; | ||
exports.isNode = isNode; | ||
var hasDOM = typeof document === 'object'; | ||
exports.hasDOM = hasDOM; | ||
}); | ||
@@ -1075,5 +1068,3 @@ define("mobiledoc-dom-renderer/utils/marker-types", ["exports"], function (exports) { | ||
}); | ||
define('mobiledoc-dom-renderer/utils/sanitization-utils', ['exports', 'mobiledoc-dom-renderer/utils/array-utils', 'mobiledoc-dom-renderer/utils/dom'], function (exports, _mobiledocDomRendererUtilsArrayUtils, _mobiledocDomRendererUtilsDom) { | ||
/* globals module */ | ||
define('mobiledoc-dom-renderer/utils/sanitization-utils', ['exports', 'mobiledoc-dom-renderer/utils/array-utils'], function (exports, _mobiledocDomRendererUtilsArrayUtils) { | ||
'use strict'; | ||
@@ -1084,2 +1075,4 @@ | ||
var PROTOCOL_REGEXP = /^([a-z0-9.+-]+:)/i; | ||
var badProtocols = ['javascript:', // jshint ignore:line | ||
@@ -1090,18 +1083,5 @@ 'vbscript:' // jshint ignore:line | ||
function getProtocol(url) { | ||
if (_mobiledocDomRendererUtilsDom.hasDOM) { | ||
/* Presume we are in a browser */ | ||
var a = document.createElement('a'); | ||
a.href = url; | ||
return a.protocol; | ||
} else if (_mobiledocDomRendererUtilsDom.isNode) { | ||
/* In node */ | ||
var nodeURL = module.require('url'); | ||
var protocol = null; | ||
if (typeof url === 'string') { | ||
protocol = nodeURL.parse(url).protocol; | ||
} | ||
return protocol === null ? ':' : protocol; | ||
} else { | ||
throw new Error('Mobiledoc DOM Renderer is unable to sanitize href tags in this environment.' + 'Provide a markupElementRenderer for the \'A\' tag.'); | ||
} | ||
var matches = url && url.match(PROTOCOL_REGEXP); | ||
var protocol = matches && matches[0] || ':'; | ||
return protocol; | ||
} | ||
@@ -1108,0 +1088,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* globals module */ | ||
'use strict'; | ||
@@ -18,7 +16,2 @@ | ||
return tagName.toLowerCase(); | ||
} | ||
var isNode = typeof window === 'undefined' && typeof module === 'object' && typeof module.require === 'function'; | ||
exports.isNode = isNode; | ||
var hasDOM = typeof document === 'object'; | ||
exports.hasDOM = hasDOM; | ||
} |
@@ -1,3 +0,1 @@ | ||
/* globals module */ | ||
'use strict'; | ||
@@ -10,3 +8,3 @@ | ||
var _dom = require('./dom'); | ||
var PROTOCOL_REGEXP = /^([a-z0-9.+-]+:)/i; | ||
@@ -18,18 +16,5 @@ var badProtocols = ['javascript:', // jshint ignore:line | ||
function getProtocol(url) { | ||
if (_dom.hasDOM) { | ||
/* Presume we are in a browser */ | ||
var a = document.createElement('a'); | ||
a.href = url; | ||
return a.protocol; | ||
} else if (_dom.isNode) { | ||
/* In node */ | ||
var nodeURL = module.require('url'); | ||
var protocol = null; | ||
if (typeof url === 'string') { | ||
protocol = nodeURL.parse(url).protocol; | ||
} | ||
return protocol === null ? ':' : protocol; | ||
} else { | ||
throw new Error('Mobiledoc DOM Renderer is unable to sanitize href tags in this environment.' + 'Provide a markupElementRenderer for the \'A\' tag.'); | ||
} | ||
var matches = url && url.match(PROTOCOL_REGEXP); | ||
var protocol = matches && matches[0] || ':'; | ||
return protocol; | ||
} | ||
@@ -36,0 +21,0 @@ |
@@ -1220,4 +1220,2 @@ ;(function() { | ||
define('mobiledoc-dom-renderer/utils/dom', ['exports'], function (exports) { | ||
/* globals module */ | ||
'use strict'; | ||
@@ -1239,7 +1237,2 @@ | ||
} | ||
var isNode = typeof window === 'undefined' && typeof module === 'object' && typeof module.require === 'function'; | ||
exports.isNode = isNode; | ||
var hasDOM = typeof document === 'object'; | ||
exports.hasDOM = hasDOM; | ||
}); | ||
@@ -1295,5 +1288,3 @@ define("mobiledoc-dom-renderer/utils/marker-types", ["exports"], function (exports) { | ||
}); | ||
define('mobiledoc-dom-renderer/utils/sanitization-utils', ['exports', 'mobiledoc-dom-renderer/utils/array-utils', 'mobiledoc-dom-renderer/utils/dom'], function (exports, _mobiledocDomRendererUtilsArrayUtils, _mobiledocDomRendererUtilsDom) { | ||
/* globals module */ | ||
define('mobiledoc-dom-renderer/utils/sanitization-utils', ['exports', 'mobiledoc-dom-renderer/utils/array-utils'], function (exports, _mobiledocDomRendererUtilsArrayUtils) { | ||
'use strict'; | ||
@@ -1304,2 +1295,4 @@ | ||
var PROTOCOL_REGEXP = /^([a-z0-9.+-]+:)/i; | ||
var badProtocols = ['javascript:', // jshint ignore:line | ||
@@ -1310,18 +1303,5 @@ 'vbscript:' // jshint ignore:line | ||
function getProtocol(url) { | ||
if (_mobiledocDomRendererUtilsDom.hasDOM) { | ||
/* Presume we are in a browser */ | ||
var a = document.createElement('a'); | ||
a.href = url; | ||
return a.protocol; | ||
} else if (_mobiledocDomRendererUtilsDom.isNode) { | ||
/* In node */ | ||
var nodeURL = module.require('url'); | ||
var protocol = null; | ||
if (typeof url === 'string') { | ||
protocol = nodeURL.parse(url).protocol; | ||
} | ||
return protocol === null ? ':' : protocol; | ||
} else { | ||
throw new Error('Mobiledoc DOM Renderer is unable to sanitize href tags in this environment.' + 'Provide a markupElementRenderer for the \'A\' tag.'); | ||
} | ||
var matches = url && url.match(PROTOCOL_REGEXP); | ||
var protocol = matches && matches[0] || ':'; | ||
return protocol; | ||
} | ||
@@ -1328,0 +1308,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* globals module */ | ||
function addHTMLSpaces(text) { | ||
@@ -15,4 +13,1 @@ let nbsp = '\u00A0'; | ||
} | ||
export const isNode = typeof window === 'undefined' && (typeof module === 'object' && typeof module.require === 'function'); | ||
export const hasDOM = typeof document === 'object'; |
@@ -1,9 +0,5 @@ | ||
/* globals module */ | ||
import { includes } from './array-utils'; | ||
import { | ||
isNode, | ||
hasDOM | ||
} from './dom'; | ||
const PROTOCOL_REGEXP = /^([a-z0-9.+-]+:)/i; | ||
const badProtocols = [ | ||
@@ -15,21 +11,5 @@ 'javascript:', // jshint ignore:line | ||
function getProtocol(url) { | ||
if (hasDOM) { | ||
/* Presume we are in a browser */ | ||
let a = document.createElement('a'); | ||
a.href = url; | ||
return a.protocol; | ||
} else if (isNode) { | ||
/* In node */ | ||
let nodeURL = module.require('url'); | ||
let protocol = null; | ||
if (typeof url === 'string') { | ||
protocol = nodeURL.parse(url).protocol; | ||
} | ||
return (protocol === null) ? ':' : protocol; | ||
} else { | ||
throw new Error( | ||
'Mobiledoc DOM Renderer is unable to sanitize href tags in this environment.' + | ||
'Provide a markupElementRenderer for the \'A\' tag.' | ||
); | ||
} | ||
let matches = url && url.match(PROTOCOL_REGEXP); | ||
let protocol = (matches && matches[0]) || ':'; | ||
return protocol; | ||
} | ||
@@ -36,0 +16,0 @@ |
{ | ||
"name": "mobiledoc-dom-renderer", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"description": "Renders Mobiledoc input to DOM output", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
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
490159
9903