style: reformat all source code by prettier
This commit is contained in:
18
dist/xss.js
vendored
18
dist/xss.js
vendored
@@ -479,7 +479,11 @@ if (typeof window !== "undefined") {
|
||||
|
||||
// using `xss` on the WebWorker, output `filterXSS` to the globals
|
||||
function isWorkerEnv() {
|
||||
return typeof self !== 'undefined' && typeof DedicatedWorkerGlobalScope !== 'undefined' && self instanceof DedicatedWorkerGlobalScope;
|
||||
return (
|
||||
typeof self !== "undefined" &&
|
||||
typeof DedicatedWorkerGlobalScope !== "undefined" &&
|
||||
self instanceof DedicatedWorkerGlobalScope
|
||||
);
|
||||
}
|
||||
if (isWorkerEnv()) {
|
||||
self.filterXSS = module.exports;
|
||||
@@ -573,11 +577,11 @@ function parseTag(html, onTag, escapeHtml) {
|
||||
tagStart = false;
|
||||
continue;
|
||||
}
|
||||
if ((c === '"' || c === "'")) {
|
||||
if (c === '"' || c === "'") {
|
||||
var i = 1;
|
||||
var ic = html.charAt(currentPos - i);
|
||||
|
||||
while ((ic.trim() === "") || (ic === "=")) {
|
||||
while (ic.trim() === "" || ic === "=") {
|
||||
if (ic === "=") {
|
||||
quoteStart = c;
|
||||
continue chariterator;
|
||||
@@ -767,7 +771,7 @@ module.exports = {
|
||||
var reg = /\s|\n|\t/;
|
||||
var match = reg.exec(str);
|
||||
return match ? match.index : -1;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
},{}],5:[function(require,module,exports){
|
||||
@@ -807,7 +811,7 @@ function getAttrs(html) {
|
||||
if (i === -1) {
|
||||
return {
|
||||
html: "",
|
||||
closing: html[html.length - 2] === "/"
|
||||
closing: html[html.length - 2] === "/",
|
||||
};
|
||||
}
|
||||
html = _.trim(html.slice(i + 1, -1));
|
||||
@@ -815,7 +819,7 @@ function getAttrs(html) {
|
||||
if (isClosing) html = _.trim(html.slice(0, -1));
|
||||
return {
|
||||
html: html,
|
||||
closing: isClosing
|
||||
closing: isClosing,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -921,7 +925,7 @@ FilterXSS.prototype.process = function(html) {
|
||||
sourcePosition: sourcePosition,
|
||||
position: position,
|
||||
isClosing: isClosing,
|
||||
isWhite: whiteList.hasOwnProperty(tag)
|
||||
isWhite: whiteList.hasOwnProperty(tag),
|
||||
};
|
||||
|
||||
// call `onTag()`
|
||||
|
||||
@@ -9,7 +9,7 @@ var readline = require("readline");
|
||||
|
||||
var rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
output: process.stdout,
|
||||
});
|
||||
|
||||
console.log('Enter a blank line to do xss(), enter "@quit" to exit.\n');
|
||||
|
||||
@@ -33,7 +33,11 @@ if (typeof window !== "undefined") {
|
||||
|
||||
// using `xss` on the WebWorker, output `filterXSS` to the globals
|
||||
function isWorkerEnv() {
|
||||
return typeof self !== 'undefined' && typeof DedicatedWorkerGlobalScope !== 'undefined' && self instanceof DedicatedWorkerGlobalScope;
|
||||
return (
|
||||
typeof self !== "undefined" &&
|
||||
typeof DedicatedWorkerGlobalScope !== "undefined" &&
|
||||
self instanceof DedicatedWorkerGlobalScope
|
||||
);
|
||||
}
|
||||
if (isWorkerEnv()) {
|
||||
self.filterXSS = module.exports;
|
||||
|
||||
@@ -85,11 +85,11 @@ function parseTag(html, onTag, escapeHtml) {
|
||||
tagStart = false;
|
||||
continue;
|
||||
}
|
||||
if ((c === '"' || c === "'")) {
|
||||
if (c === '"' || c === "'") {
|
||||
var i = 1;
|
||||
var ic = html.charAt(currentPos - i);
|
||||
|
||||
while ((ic.trim() === "") || (ic === "=")) {
|
||||
while (ic.trim() === "" || ic === "=") {
|
||||
if (ic === "=") {
|
||||
quoteStart = c;
|
||||
continue chariterator;
|
||||
|
||||
@@ -30,5 +30,5 @@ module.exports = {
|
||||
var reg = /\s|\n|\t/;
|
||||
var match = reg.exec(str);
|
||||
return match ? match.index : -1;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ function getAttrs(html) {
|
||||
if (i === -1) {
|
||||
return {
|
||||
html: "",
|
||||
closing: html[html.length - 2] === "/"
|
||||
closing: html[html.length - 2] === "/",
|
||||
};
|
||||
}
|
||||
html = _.trim(html.slice(i + 1, -1));
|
||||
@@ -42,7 +42,7 @@ function getAttrs(html) {
|
||||
if (isClosing) html = _.trim(html.slice(0, -1));
|
||||
return {
|
||||
html: html,
|
||||
closing: isClosing
|
||||
closing: isClosing,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ FilterXSS.prototype.process = function(html) {
|
||||
sourcePosition: sourcePosition,
|
||||
position: position,
|
||||
isClosing: isClosing,
|
||||
isWhite: whiteList.hasOwnProperty(tag)
|
||||
isWhite: whiteList.hasOwnProperty(tag),
|
||||
};
|
||||
|
||||
// call `onTag()`
|
||||
|
||||
@@ -21,7 +21,7 @@ console.log(
|
||||
onTag(tag: string, html: string, options: {}): string {
|
||||
return html;
|
||||
},
|
||||
css: false
|
||||
css: false,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ xss.filterXSS("hello", {
|
||||
onTag(tag, html, options) {
|
||||
return html;
|
||||
},
|
||||
onIgnoreTag(tag, html) {}
|
||||
onIgnoreTag(tag, html) {},
|
||||
});
|
||||
|
||||
interface ICustomWhiteList extends XSS.IWhiteList {
|
||||
|
||||
Reference in New Issue
Block a user