ultramarked
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -10,3 +10,3 @@ { | ||
}, | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"repository": { | ||
@@ -13,0 +13,0 @@ "type": "git", |
@@ -33,3 +33,3 @@ # ultramarked | ||
If you are using `ultrasanitize`, you can pass in an array of strings or regular expressions that match permitted `iframe` targets. | ||
If you are using `ultrasanitize`, you can pass in an array of strings or regular expressions that match permitted `iframe` targets. Regular expressions are tested against user input, and strings are interpreted as the beginning of a URL. This means that an string like `'http://google.com'` will match any URL in the `google.com` domain that uses the `HTTP` protocol. | ||
@@ -36,0 +36,0 @@ ### options.terminal |
@@ -80,8 +80,11 @@ /* | ||
function htmlParser( html, handler ) { | ||
var index, chars, match, stack = [], last = html; | ||
stack.lastItem = function() { return stack[ stack.length - 1 ]; }; | ||
var index, chars, match, stack = [], last = html; | ||
while ( html ) { | ||
chars = true; | ||
stack.lastItem = function () { | ||
return stack[ stack.length - 1 ]; | ||
}; | ||
while ( html ) { | ||
chars = true; | ||
// Make sure we're not in a script or style element | ||
@@ -218,3 +221,3 @@ if ( !stack.lastItem() || !specialElements[ stack.lastItem() ] ) { | ||
if (typeof value === 'string') { | ||
return attrs.src === value; | ||
return attrs.src.lastIndexOf(value, 0) === 0; | ||
} | ||
@@ -380,10 +383,13 @@ return value.test(attrs.src); | ||
var lowercase = function(string){return typeof string === 'string' ? string.toLowerCase() : string;}; | ||
function lowercase (string) { | ||
return typeof string === 'string' ? string.toLowerCase() : string; | ||
} | ||
module.exports = function(html, options){ | ||
var buffer = []; | ||
module.exports = function (html, options) { | ||
var emptyIframe = /<iframe>\s*<\/iframe>/ig; | ||
var buffer = []; | ||
htmlParser(html, htmlSanitizeWriter(buffer, options)); | ||
htmlParser(html, htmlSanitizeWriter(buffer, options)); | ||
return buffer.join(''); | ||
return buffer.join('').replace(emptyIframe, ''); | ||
}; |
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
52086
530