related to #75 mask password input by default

This commit is contained in:
Yanzhen Yu
2021-05-13 02:18:54 +08:00
parent 0bb95f1ee7
commit 0d1dbdd0a7

View File

@@ -110,7 +110,7 @@ export function absoluteToStylesheet(
); );
} }
const SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/; // Don't use \s, to avoid matching non-breaking space const SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/; // Don't use \s, to avoid matching non-breaking space
const SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/; const SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
function getAbsoluteSrcsetString(doc: Document, attributeValue: string) { function getAbsoluteSrcsetString(doc: Document, attributeValue: string) {
/* /*
@@ -129,7 +129,7 @@ function getAbsoluteSrcsetString(doc: Document, attributeValue: string) {
function collectCharacters(regEx: RegExp) { function collectCharacters(regEx: RegExp) {
var chars, var chars,
match = regEx.exec(attributeValue.substring(pos)); match = regEx.exec(attributeValue.substring(pos));
if (match) { if (match) {
chars = match[0]; chars = match[0];
pos += chars.length; pos += chars.length;
@@ -148,13 +148,13 @@ function getAbsoluteSrcsetString(doc: Document, attributeValue: string) {
let url = collectCharacters(SRCSET_NOT_SPACES); let url = collectCharacters(SRCSET_NOT_SPACES);
if (url.slice(-1) === ',') { if (url.slice(-1) === ',') {
// aside: according to spec more than one comma at the end is a parse error, but we ignore that // aside: according to spec more than one comma at the end is a parse error, but we ignore that
url = absoluteToDoc(doc, url.substring(0, url.length - 1)) url = absoluteToDoc(doc, url.substring(0, url.length - 1));
// the trailing comma splits the srcset, so the interpretion is that // the trailing comma splits the srcset, so the interpretion is that
// another url will follow, and the descriptor is empty // another url will follow, and the descriptor is empty
output.push(url); output.push(url);
} else { } else {
let descriptorsStr = ''; let descriptorsStr = '';
url = absoluteToDoc(doc, url) url = absoluteToDoc(doc, url);
let inParens = false; let inParens = false;
while (true) { while (true) {
let c = attributeValue.charAt(pos); let c = attributeValue.charAt(pos);
@@ -165,7 +165,7 @@ function getAbsoluteSrcsetString(doc: Document, attributeValue: string) {
if (c === ',') { if (c === ',') {
pos += 1; pos += 1;
output.push((url + descriptorsStr).trim()); output.push((url + descriptorsStr).trim());
break; // parse the next url break; // parse the next url
} else if (c === '(') { } else if (c === '(') {
inParens = true; inParens = true;
} }
@@ -863,9 +863,12 @@ function snapshot(
week: true, week: true,
textarea: true, textarea: true,
select: true, select: true,
password: true,
} }
: maskAllInputs === false : maskAllInputs === false
? {} ? {
password: true,
}
: maskAllInputs; : maskAllInputs;
const slimDOMOptions: SlimDOMOptions = const slimDOMOptions: SlimDOMOptions =
slimDOM === true || slimDOM === 'all' slimDOM === true || slimDOM === 'all'