LibWeb: Add TextEncoder encodeInto

This commit is contained in:
Bastiaan van der Plaat 2023-10-06 07:03:44 +02:00 committed by Andreas Kling
commit 0104225d9b
Notes: sideshowbarker 2024-07-17 11:34:34 +09:00
9 changed files with 123 additions and 10 deletions

View file

@ -1,9 +1,20 @@
[Exposed=(Window,Worker)]
// https://encoding.spec.whatwg.org/#textencodercommon
interface mixin TextEncoderCommon {
readonly attribute DOMString encoding;
};
// https://encoding.spec.whatwg.org/#dictdef-textencoderencodeintoresult
dictionary TextEncoderEncodeIntoResult {
unsigned long long read;
unsigned long long written;
};
// https://encoding.spec.whatwg.org/#textencoder
[Exposed=*]
interface TextEncoder {
constructor();
[NewObject] Uint8Array encode(optional USVString input = "");
// TextEncoderEncodeIntoResult encodeInto(USVString source, [AllowShared] Uint8Array destination);
readonly attribute DOMString encoding;
TextEncoderEncodeIntoResult encodeInto(USVString source, [AllowShared] Uint8Array destination);
};
TextEncoder includes TextEncoderCommon;