-
-
Notifications
You must be signed in to change notification settings - Fork 685
fix data url test #2580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix data url test #2580
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -604,14 +604,18 @@ function isHTTPWhiteSpace (char) { | |
| * @param {boolean} [trailing=true] | ||
| */ | ||
| function removeHTTPWhitespace (str, leading = true, trailing = true) { | ||
| let i = 0; let j = str.length | ||
| let lead = 0 | ||
| let trail = str.length - 1 | ||
|
|
||
| if (leading) { | ||
| while (j > i && isHTTPWhiteSpace(str.charCodeAt(i))) --i | ||
| while (lead < str.length && isHTTPWhiteSpace(str.charCodeAt(lead))) lead++ | ||
| } | ||
|
|
||
| if (trailing) { | ||
| while (j > i && isHTTPWhiteSpace(str.charCodeAt(j - 1))) --j | ||
| while (trail > 0 && isHTTPWhiteSpace(str.charCodeAt(trail))) trail-- | ||
| } | ||
| return i === 0 && j === str.length ? str : str.substring(i, j) | ||
|
|
||
| return lead === 0 && trail === str.length - 1 ? str : str.slice(lead, trail + 1) | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -630,14 +634,18 @@ function isASCIIWhitespace (char) { | |
| * @param {boolean} [trailing=true] | ||
| */ | ||
| function removeASCIIWhitespace (str, leading = true, trailing = true) { | ||
| let i = 0; let j = str.length | ||
| let lead = 0 | ||
| let trail = str.length - 1 | ||
|
|
||
| if (leading) { | ||
| while (j > i && isASCIIWhitespace(str.charCodeAt(i))) --i | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so unless
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also using |
||
| while (lead < str.length && isASCIIWhitespace(str.charCodeAt(lead))) lead++ | ||
KhafraDev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| if (trailing) { | ||
| while (j > i && isASCIIWhitespace(str.charCodeAt(j - 1))) --j | ||
| while (trail > 0 && isASCIIWhitespace(str.charCodeAt(trail))) trail-- | ||
| } | ||
| return i === 0 && j === str.length ? str : str.substring(i, j) | ||
|
|
||
| return lead === 0 && trail === str.length - 1 ? str : str.slice(lead, trail + 1) | ||
| } | ||
|
|
||
| module.exports = { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.