Skip to content

Commit 517fe3a

Browse files
committed
cleaner
1 parent 73151f1 commit 517fe3a

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

whatwg.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*
2929
* @param encoding - The encoding label per WHATWG Encoding spec
3030
* @param input - Input bytes to encode
31-
* @param percentEncodeSet - A string of chars escape in addition to C0 control percent-encode set
31+
* @param percentEncodeSet - A string of chars to escape in addition to C0 control percent-encode set
3232
* @param spaceAsPlus - Whether to encode space as `'+'` instead of `'%20'` or `' '` (default: false)
3333
* @returns The percent-encoded string
3434
*/

whatwg.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,16 @@ export function percentEncodeAfterEncoding(encoding, input, percentEncodeSet, sp
5252
let cp = x
5353
if (x >= 0xd8_00 && x < 0xe0_00) {
5454
if (x >= 0xdc_00 || i + 1 === len) throw new SyntaxError(E_STRICT_UNICODE)
55-
const x1 = input.charCodeAt(i + 1)
55+
const x1 = input.charCodeAt(++i)
5656
if (x1 < 0xdc_00 || x1 >= 0xe0_00) throw new SyntaxError(E_STRICT_UNICODE)
5757
cp = 0x1_00_00 + ((x1 & 0x3_ff) | ((x & 0x3_ff) << 10))
58-
i++
5958
}
6059

6160
res += `${percent(u, last, i)}%26%23${cp}%3B` // &#cp;
6261
last = i + 1 // skip current
62+
} else {
63+
u[i] = b
6364
}
64-
65-
u[i] = b
6665
}
6766

6867
res += percent(u, last)

0 commit comments

Comments
 (0)