mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Use String.prototype.replaceAll()
where appropriate
This fairly new method allows replacing *multiple* occurrences within a string without having to use regular expressions. Please refer to: - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll#browser_compatibility
This commit is contained in:
parent
076bb30b6c
commit
5f64621d46
10 changed files with 15 additions and 15 deletions
|
@ -352,7 +352,7 @@ class PDFLinkService {
|
|||
if (params.has("search")) {
|
||||
this.eventBus.dispatch("findfromurlhash", {
|
||||
source: this,
|
||||
query: params.get("search").replace(/"/g, ""),
|
||||
query: params.get("search").replaceAll('"', ""),
|
||||
phraseSearch: params.get("phrase") === "true",
|
||||
});
|
||||
}
|
||||
|
|
|
@ -211,7 +211,6 @@ function parseQueryString(query) {
|
|||
return params;
|
||||
}
|
||||
|
||||
const NullCharactersRegExp = /\x00/g;
|
||||
const InvisibleCharactersRegExp = /[\x01-\x1F]/g;
|
||||
|
||||
/**
|
||||
|
@ -226,7 +225,7 @@ function removeNullCharacters(str, replaceInvisible = false) {
|
|||
if (replaceInvisible) {
|
||||
str = str.replace(InvisibleCharactersRegExp, " ");
|
||||
}
|
||||
return str.replace(NullCharactersRegExp, "");
|
||||
return str.replaceAll("\x00", "");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue