mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 06:38:07 +02:00
Use a limit, in more places, when splitting strings
This should be a *tiny* bit more efficient, since it avoids parsing substrings that we don't care about. *Please note:* I cannot find an ESLint rule to enforce this automatically.
This commit is contained in:
parent
af4d2fa53c
commit
363dce6744
6 changed files with 8 additions and 8 deletions
|
@ -47,7 +47,7 @@ limitations under the License.
|
|||
}
|
||||
var scheme = url.slice(0, schemeIndex).toLowerCase();
|
||||
if (schemes.includes(scheme)) {
|
||||
url = url.split("#")[0];
|
||||
url = url.split("#", 1)[0];
|
||||
if (url.charAt(schemeIndex) === ":") {
|
||||
url = encodeURIComponent(url);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue