1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2/* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * The origin of this IDL file is 7 * http://encoding.spec.whatwg.org/#interface-textencoder 8 * 9 * Any copyright is dedicated to the Public Domain. 10 * http://creativecommons.org/publicdomain/zero/1.0/ 11 */ 12 13[Constructor, 14 Exposed=(Window,Worker,System)] 15interface TextEncoder { 16 [Constant] 17 readonly attribute DOMString encoding; 18 /* 19 * This is spec-wise USVString but marking it as 20 * DOMString to avoid duplicate work. Since the 21 * UTF-16 to UTF-8 converter performs processing 22 * that's equivalent to first converting a 23 * DOMString to a USVString, let's avoid having 24 * the binding code doing it, too. 25 */ 26 [NewObject] 27 Uint8Array encode(optional DOMString input = ""); 28}; 29