Skip to content

Commit 0d1dbdd

Browse files
committed
related to #75 mask password input by default
1 parent 0bb95f1 commit 0d1dbdd

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/snapshot.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export function absoluteToStylesheet(
110110
);
111111
}
112112

113-
const SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/; // Don't use \s, to avoid matching non-breaking space
113+
const SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/; // Don't use \s, to avoid matching non-breaking space
114114
const SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
115115
function getAbsoluteSrcsetString(doc: Document, attributeValue: string) {
116116
/*
@@ -129,7 +129,7 @@ function getAbsoluteSrcsetString(doc: Document, attributeValue: string) {
129129

130130
function collectCharacters(regEx: RegExp) {
131131
var chars,
132-
match = regEx.exec(attributeValue.substring(pos));
132+
match = regEx.exec(attributeValue.substring(pos));
133133
if (match) {
134134
chars = match[0];
135135
pos += chars.length;
@@ -148,13 +148,13 @@ function getAbsoluteSrcsetString(doc: Document, attributeValue: string) {
148148
let url = collectCharacters(SRCSET_NOT_SPACES);
149149
if (url.slice(-1) === ',') {
150150
// aside: according to spec more than one comma at the end is a parse error, but we ignore that
151-
url = absoluteToDoc(doc, url.substring(0, url.length - 1))
151+
url = absoluteToDoc(doc, url.substring(0, url.length - 1));
152152
// the trailing comma splits the srcset, so the interpretion is that
153153
// another url will follow, and the descriptor is empty
154154
output.push(url);
155155
} else {
156156
let descriptorsStr = '';
157-
url = absoluteToDoc(doc, url)
157+
url = absoluteToDoc(doc, url);
158158
let inParens = false;
159159
while (true) {
160160
let c = attributeValue.charAt(pos);
@@ -165,7 +165,7 @@ function getAbsoluteSrcsetString(doc: Document, attributeValue: string) {
165165
if (c === ',') {
166166
pos += 1;
167167
output.push((url + descriptorsStr).trim());
168-
break; // parse the next url
168+
break; // parse the next url
169169
} else if (c === '(') {
170170
inParens = true;
171171
}
@@ -863,9 +863,12 @@ function snapshot(
863863
week: true,
864864
textarea: true,
865865
select: true,
866+
password: true,
866867
}
867868
: maskAllInputs === false
868-
? {}
869+
? {
870+
password: true,
871+
}
869872
: maskAllInputs;
870873
const slimDOMOptions: SlimDOMOptions =
871874
slimDOM === true || slimDOM === 'all'

0 commit comments

Comments
 (0)